Skip to content

Commit

Permalink
Fixed null reference issues
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorza committed Jan 17, 2023
1 parent 5fe96af commit cf1e28c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion UARTReplacement/SerialPort.cs
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ public int Baud

public void Reset(byte ResetByte)
{
if (port is null) return;
// bit 7 = Indicates the reset signal to the expansion bus and esp is asserted
bool resetESP = (ResetByte & 128) == 128;
if (resetESP)
Expand All @@ -216,7 +217,7 @@ public void EnableEspGpio(byte EnableByte)

public void SetEspGpio(byte GpioByte)
{
if (enableEspGpio)
if (enableEspGpio || port is null)
return;

// bit 0 = Read / Write ESP GPIO0 (hard reset = 1)
Expand Down

0 comments on commit cf1e28c

Please sign in to comment.