Some fix to sicshipadaba to prevent problems when trying to format a NULL node

Protected the nagging messages from scans/etc from missing data
This commit is contained in:
2017-03-15 16:45:52 +01:00
parent e8ae653095
commit e94e80264d
2 changed files with 10 additions and 6 deletions

View File

@@ -2065,7 +2065,7 @@ pDynString formatValue(hdbValue v, pHdb node)
DynStringCopy(result, number);
break;
case HIPFLOAT:
if (GetHdbProperty(node, "fmt", format, sizeof format - 1)) {
if (node != NULL && GetHdbProperty(node, "fmt", format, sizeof format - 1)) {
snprintf(number, 30, format, v.v.doubleValue);
} else {
snprintf(number, 30, "%.6g", v.v.doubleValue);
@@ -2084,7 +2084,7 @@ pDynString formatValue(hdbValue v, pHdb node)
break;
case HIPFLOATAR:
case HIPFLOATVARAR:
if (GetHdbProperty(node, "fmt", format + 1, sizeof format - 2)) {
if (node != NULL && GetHdbProperty(node, "fmt", format + 1, sizeof format - 2)) {
format[0] = ' ';
} else {
strcpy(format, " %.6g");

View File

@@ -142,12 +142,13 @@ int CheckSum(SConnection * pCon, SicsInterp * pSics, void *pData,
return 0;
}
/*-----------------------------------------------------------------------------*/
void LogUserInfo(void *data)
void LogUserInfo(void *pData)
{
hdbValue user, proposal;
SConnection *pCon = (SConnection *)data;
SConnection *pCon = (SConnection *)pData;
pDynString data;
if(data == NULL){
if(pData == NULL){
return;
}
user = MakeHdbText(strdup("Martina Notconfigured"));
@@ -155,7 +156,10 @@ void LogUserInfo(void *data)
sget("user",&user);
sget("proposalid",&proposal);
SCPrintf(pCon,eLog,"WARNING: Saving data for %s, proposal %s", user.v.text, proposal.v.text);
data = formatValue(proposal,NULL);
SCPrintf(pCon,eLog,"WARNING: Saving data for %s, proposal %s", user.v.text,
GetCharArray(data));
DeleteDynString(data);
ReleaseHdbValue(&user);
ReleaseHdbValue(&proposal);