critical relability fix

This commit is contained in:
2024-08-23 18:35:39 +03:00
parent f672878873
commit e5e24943a6
3 changed files with 17 additions and 5 deletions

View File

@@ -570,7 +570,7 @@ return 0;
aJsonObject * canDriver::getConfbyID(uint8_t devId) aJsonObject * canDriver::getConfbyID(uint8_t devId)
{ {
if (!canConfigObj) return NULL; if (!canConfigObj) return NULL;
if (!canRemoteConfigObj) return NULL; if (!canRemoteConfigObj || canRemoteConfigObj->type != aJson_Object) return NULL;
aJsonObject * remoteConfObj=canRemoteConfigObj->child; aJsonObject * remoteConfObj=canRemoteConfigObj->child;
while (remoteConfObj) while (remoteConfObj)
{ {
@@ -587,7 +587,7 @@ return NULL;
aJsonObject * canDriver::findConfbyName(char* devName, int * devAddr) aJsonObject * canDriver::findConfbyName(char* devName, int * devAddr)
{ {
if (!canRemoteConfigObj && !devName) return NULL; if (!canRemoteConfigObj || canRemoteConfigObj->type != aJson_Object || !devName ) return NULL;
aJsonObject * remoteConfObj=canRemoteConfigObj->child; aJsonObject * remoteConfObj=canRemoteConfigObj->child;
while (remoteConfObj) while (remoteConfObj)
{ {
@@ -616,7 +616,7 @@ extern PubSubClient mqttClient;
bool canDriver::subscribeTopics(char * root, size_t buflen) bool canDriver::subscribeTopics(char * root, size_t buflen)
{ {
if (!root) return false; if (!root) return false;
if (!canRemoteConfigObj) return false; if (!canRemoteConfigObj || canRemoteConfigObj->type != aJson_Object) return false;
int rootLen = strlen(root); int rootLen = strlen(root);

View File

@@ -341,13 +341,13 @@ uint16_t getCanNum(aJsonObject* verb)
case aJson_Array: case aJson_Array:
{ {
aJsonObject *canNumObj=aJson.getArrayItem(verb,1); aJsonObject *canNumObj=aJson.getArrayItem(verb,1);
if (canNumObj->type == aJson_Int) return canNumObj->valueint; if (canNumObj && canNumObj->type == aJson_Int) return canNumObj->valueint;
return 0; return 0;
} }
case aJson_Object: case aJson_Object:
{ {
aJsonObject *canNumObj=aJson.getObjectItem(verb, "can"); aJsonObject *canNumObj=aJson.getObjectItem(verb, "can");
if (canNumObj->type == aJson_Int) return canNumObj->valueint; if (canNumObj && canNumObj->type == aJson_Int) return canNumObj->valueint;
return 0; return 0;
} }
} }

View File

@@ -2717,6 +2717,18 @@ infoSerial<<F("\n(+)CAN");
#else #else
infoSerial<<F("\n(-)CAN"); infoSerial<<F("\n(-)CAN");
#endif #endif
#ifdef PULSEPIN12
infoSerial<<F("\n(+)PULSE on PIN12");
#else
infoSerial<<F("\n(-)PULSE on PIN12");
#endif
#ifdef CRYPT
infoSerial<<F("\n(+)CRYPT");
#else
infoSerial<<F("\n(-)CRYPT");
#endif
//#ifdef IPMODBUS //#ifdef IPMODBUS
//infoSerial<<F("\n(+)IPMODBUS"); //infoSerial<<F("\n(+)IPMODBUS");
//#endif //#endif