Skip to content

Commit

Permalink
Improved string parsing validation when discovering Meadow devices
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianstevens committed May 8, 2024
1 parent e36076c commit a4a0b00
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,11 @@ public static async Task<IList<string>> GetMeadowSerialPortsForOsx()
if (foundMeadow && line.Contains("IODialinDevice"))
{
int startIndex = line.IndexOf("/");
if (startIndex == -1) { continue; }
int endIndex = line.IndexOf("\"", startIndex + 1);
if (endIndex == -1) { continue; }
var port = line.Substring(startIndex, endIndex - startIndex);
ports.Add(port);
Expand Down

0 comments on commit a4a0b00

Please sign in to comment.