nullable
This commit is contained in:
parent
076b6fc271
commit
9bcfd75aa2
@ -41,9 +41,9 @@ public abstract class SerialShocker : Shocker
|
|||||||
string regEnum = CUR_CTRL + "Enum\\" + deviceID + "\\Device Parameters";
|
string regEnum = CUR_CTRL + "Enum\\" + deviceID + "\\Device Parameters";
|
||||||
string? portName = Registry.GetValue(regEnum, "PortName", "")?.ToString();
|
string? portName = Registry.GetValue(regEnum, "PortName", "")?.ToString();
|
||||||
|
|
||||||
int s32_Pos = caption.IndexOf(" (COM");
|
int? s32Pos = caption?.IndexOf(" (COM");
|
||||||
if (s32_Pos > 0) // remove COM port from description
|
if (s32Pos > 0) // remove COM port from description
|
||||||
caption = caption.Substring(0, s32_Pos);
|
caption = caption?.Substring(0, (int)s32Pos);
|
||||||
|
|
||||||
ret.Add(new SerialPortInfo(
|
ret.Add(new SerialPortInfo(
|
||||||
portName,
|
portName,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user