Skip to content

Commit

Permalink
APFirmware: add nullchecks
Browse files Browse the repository at this point in the history
  • Loading branch information
meee1 committed Jun 19, 2021
1 parent ab7644c commit 5430f8e
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions ExtLibs/ArduPilot/APFirmware.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,12 @@ public static void GetList(string url = "https://firmware.ardupilot.org/manifest
{
GetList();

log.Info("device: "+device.ToJSON());

// match the board description
var ans = Manifest.Firmware.Where(a => (
a.Platform.ToLower() == device.board.ToLower() ||
a.BootloaderStr.Any(b => b.ToLower() == device.board.ToLower())) && a.BoardId != 0);
a.Platform?.ToLower() == device.board?.ToLower() ||
a.BootloaderStr.Any(b => b?.ToLower() == device.board?.ToLower())) && a.BoardId != 0);

if (ans.Any())
{
Expand Down Expand Up @@ -152,10 +154,12 @@ public static List<FirmwareInfo> GetOptions(DeviceInfo device, RELEASE_TYPES? re
{
GetList();

log.Info("device: "+device.ToJSON());

// match the board description
var ans = Manifest.Firmware.Where(a => (
a.Platform.ToLower() == device.board.ToLower() ||
a.BootloaderStr.Any(b => b.ToLower() == device.board.ToLower())) && a.BoardId != 0);
a.Platform?.ToLower() == device.board?.ToLower() ||
a.BootloaderStr.Any(b => b?.ToLower() == device.board?.ToLower())) && a.BoardId != 0);

// ignore platform
ans = Manifest.Firmware;
Expand Down

0 comments on commit 5430f8e

Please sign in to comment.