- IEC 61850 client: ControlObjectClient - avoid crash when "ctlVal" is not present in "Oper", also accept "setMag" instead of "ctlVal".

pull/93/head
Michael Zillgith 7 years ago
parent 23208aa066
commit f644b8d777

@ -28,10 +28,6 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="AssemblyInfo.cs" />

@ -162,8 +162,13 @@ ControlObjectClient_create(const char* objectReference, IedConnection connection
ctlVal = MmsVariableSpecification_getNamedVariableRecursive(oper, "ctlVal");
if (MmsVariableSpecification_getType(ctlVal) == MMS_STRUCTURE)
isAPC = true;
if (ctlVal == NULL)
ctlVal = MmsVariableSpecification_getNamedVariableRecursive(oper, "setMag");
if (ctlVal) {
if (MmsVariableSpecification_getType(ctlVal) == MMS_STRUCTURE)
isAPC = true;
}
MmsVariableSpecification* operTm = MmsVariableSpecification_getNamedVariableRecursive(oper, "operTm");
@ -211,20 +216,24 @@ ControlObjectClient_create(const char* objectReference, IedConnection connection
self->analogValue = NULL;
/* Check for T element type (Binary time -> Ed.1,UTC time -> Ed.2) */
if (MmsVariableSpecification_getType(t) == MMS_BINARY_TIME)
self->edition = 1;
if (t) {
if (MmsVariableSpecification_getType(t) == MMS_BINARY_TIME)
self->edition = 1;
else
self->edition = 2;
}
else
self->edition = 2;
self->edition = 1;
if (DEBUG_IED_CLIENT)
printf("IED_CLIENT: Detected edition %i control\n", self->edition);
iedConnection_addControlClient(connection, self);
free_varspec:
free_varspec:
MmsVariableSpecification_destroy(ctlVarSpec);
exit_function:
exit_function:
return self;
}

Loading…
Cancel
Save