Skip to content

Commit

Permalink
[CLI] Ensure defaults for String ^ type values in RegisteredEvent
Browse files Browse the repository at this point in the history
… and `VariableRequest` structs (fixes possible null exceptions in some cases). (Fix take 2.)
  • Loading branch information
mpaperno committed Mar 2, 2024
1 parent 5621129 commit 1632ed1
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/WASimClient_CLI/Structs.h
Original file line number Diff line number Diff line change
Expand Up @@ -474,14 +474,14 @@ namespace WASimCommander::CLI::Structs
{
public:
UInt32 eventId;
String ^code;
String ^name;
String ^ code { String::Empty };
String ^ name { String::Empty };

RegisteredEvent() {}
explicit RegisteredEvent(UInt32 eventId, String ^code) :
eventId{eventId}, code{code}, name{""} {}
eventId{eventId}, code{code} { }
explicit RegisteredEvent(UInt32 eventId, String ^code, String ^name) :
eventId{eventId}, code{code}, name{name} {}
eventId{eventId}, code{code}, name{name} { }

String ^ToString() override {
return String::Format("RegisteredEvent {{{0}; code: {1}; name: {2}}}", eventId, code, name);
Expand All @@ -506,8 +506,8 @@ namespace WASimCommander::CLI::Structs
{
public:
SByte variableType { 'L' };
String ^ variableName;
String ^ unitName;
String ^ variableName { String::Empty };
String ^ unitName { String::Empty };
int variableId { -1 };
int unitId { -1 };
Byte simVarIndex { 0 };
Expand Down

0 comments on commit 1632ed1

Please sign in to comment.