Skip to content

Commit 9672e79

Browse files
committed
bugfixes
1 parent ff4dc9c commit 9672e79

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

src/MicroOcpp/Model/Authorization/AuthorizationList.cpp

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ bool AuthorizationList::readJson(Clock& clock, JsonArray authlistJson, int listV
174174
// Insert new entries
175175
for (size_t i = 0; i < authlistJson.size(); i++) {
176176

177-
if (!authlistJson[i].containsKey(AUTHDATA_KEY_IDTAGINFO)) {
177+
if (!internalFormat && !authlistJson[i].containsKey(AUTHDATA_KEY_IDTAGINFO)) {
178178
// remove already handled above
179179
continue;
180180
}
@@ -209,6 +209,20 @@ bool AuthorizationList::readJson(Clock& clock, JsonArray authlistJson, int listV
209209
}
210210
}
211211

212+
// sanity check 1
213+
if (resWritten != resListSize) {
214+
MO_DBG_ERR("internal error");
215+
goto fail;
216+
}
217+
218+
// sanity check 2
219+
for (size_t i = 0; i < resListSize; i++) {
220+
if (!resList[i]) {
221+
MO_DBG_ERR("internal error");
222+
goto fail;
223+
}
224+
}
225+
212226
qsort(resList, resListSize, sizeof(resList[0]),
213227
[] (const void* a,const void* b) -> int {
214228
return strcmp(

0 commit comments

Comments
 (0)