Skip to content

Commit

Permalink
handle empty output from idb list-targets
Browse files Browse the repository at this point in the history
Summary: `idb list-targets --json` outputs empty string, which is not a valid JSON.

Reviewed By: nikoant

Differential Revision: D57614884

fbshipit-source-id: 572e9e5e44be1cde04d0c74fbff44a92d2a72fd3
  • Loading branch information
antonk52 authored and facebook-github-bot committed May 21, 2024
1 parent f049151 commit b282392
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions desktop/doctor/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,14 @@ export function getHealthchecks(): FlipperDoctor.Healthchecks {
const devices = result.stdout
.trim()
.split('\n')
.map((x) => JSON.parse(x))
.filter((x) => x.type === 'simulator');
.map((x) => {
try {
return JSON.parse(x);
} catch (e) {
return null;
}
})
.filter((x) => x != null && x.type === 'simulator');

if (devices.length === 0) {
return {
Expand Down

0 comments on commit b282392

Please sign in to comment.