Prevent SEGV in ansto_sctdriveadapter on node not found and add names to messages
This commit is contained in:
@ -310,7 +310,7 @@ int ANSTO_SctMakeDriveAdapter(SConnection *pCon, SicsInterp *pSics, void *object
|
|||||||
pSICSOBJ obj = NULL;
|
pSICSOBJ obj = NULL;
|
||||||
hdbCallback *cb;
|
hdbCallback *cb;
|
||||||
|
|
||||||
if(argc < 4){
|
if(argc < 5){
|
||||||
SCWrite(pCon,"ERROR: not enough arguments for ANSTO_SctMakeDriveAdapter", eError);
|
SCWrite(pCon,"ERROR: not enough arguments for ANSTO_SctMakeDriveAdapter", eError);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -324,19 +324,21 @@ int ANSTO_SctMakeDriveAdapter(SConnection *pCon, SicsInterp *pSics, void *object
|
|||||||
|
|
||||||
pNew->write_node = FindHdbNode(NULL, argv[2], pCon);
|
pNew->write_node = FindHdbNode(NULL, argv[2], pCon);
|
||||||
if (pNew->write_node == NULL)
|
if (pNew->write_node == NULL)
|
||||||
SCWrite(pCon, "ERROR: write-node not found", eError);
|
SCPrintf(pCon, eError, "ERROR: write-node %s not found", argv[2]);
|
||||||
if (pNew->write_node->value.dataType != HIPFLOAT && pNew->write_node->value.dataType != HIPINT) {
|
else if (pNew->write_node->value.dataType != HIPFLOAT && pNew->write_node->value.dataType != HIPINT) {
|
||||||
SCWrite(pCon, "ERROR: write-node not INT or FLOAT", eError);
|
SCPrintf(pCon, eError, "ERROR: write-node %s not INT or FLOAT", argv[2]);
|
||||||
pNew->write_node = NULL;
|
pNew->write_node = NULL;
|
||||||
}
|
}
|
||||||
pNew->read_node = FindHdbNode(NULL, argv[3], pCon);
|
pNew->read_node = FindHdbNode(NULL, argv[3], pCon);
|
||||||
if (pNew->read_node->value.dataType != HIPFLOAT && pNew->read_node->value.dataType != HIPINT) {
|
if (pNew->read_node == NULL)
|
||||||
SCWrite(pCon, "ERROR: read-node not INT or FLOAT", eError);
|
SCPrintf(pCon, eError, "ERROR: read-node %s not found", argv[3]);
|
||||||
|
else if (pNew->read_node->value.dataType != HIPFLOAT && pNew->read_node->value.dataType != HIPINT) {
|
||||||
|
SCPrintf(pCon, eError, "ERROR: read-node %s not INT or FLOAT", argv[3]);
|
||||||
pNew->write_node = NULL;
|
pNew->write_node = NULL;
|
||||||
}
|
}
|
||||||
obj = FindCommandData(pSics,argv[4], "SctController");
|
obj = FindCommandData(pSics,argv[4], "SctController");
|
||||||
if (obj == NULL)
|
if (obj == NULL)
|
||||||
SCWrite(pCon, "ERROR: controller not found", eError);
|
SCPrintf(pCon, eError, "ERROR: controller %s not found", argv[4]);
|
||||||
if (pNew->write_node == NULL || pNew->read_node == NULL || obj == NULL) {
|
if (pNew->write_node == NULL || pNew->read_node == NULL || obj == NULL) {
|
||||||
SctDriveKill(pNew);
|
SctDriveKill(pNew);
|
||||||
return 0;
|
return 0;
|
||||||
|
Reference in New Issue
Block a user