Skip to content

Commit

Permalink
network.cpp: fix setTimeZone panic
Browse files Browse the repository at this point in the history
  • Loading branch information
dingo35 committed Oct 18, 2024
1 parent c9e4f7b commit 91c3dde
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Sensorbox2_ESP/src/network.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -743,7 +743,7 @@ void setTimeZone(void * parameter) {
if( httpCode != HTTP_CODE_OK && httpCode != HTTP_CODE_MOVED_PERMANENTLY ) {
_LOG_A("Error on HTTP request (httpCode=%i)\n", httpCode);
httpClient.end();
return;
vTaskDelete(NULL); //end this task so it will not take up resources
}

// The filter: it contains "true" for each value we want to keep
Expand All @@ -754,12 +754,12 @@ void setTimeZone(void * parameter) {
httpClient.end();
if (error) {
_LOG_A("deserializeJson() failed: %s\n", error.c_str());
return;
vTaskDelete(NULL); //end this task so it will not take up resources
}
String tzname = doc2["timezone"];
if (tzname == "") {
_LOG_A("Could not detect Timezone.\n");
return;
vTaskDelete(NULL); //end this task so it will not take up resources
}
_LOG_A("Timezone detected: tz=%s.\n", tzname.c_str());

Expand All @@ -777,7 +777,7 @@ void setTimeZone(void * parameter) {
_LOG_A("Error on HTTP request (httpCode=%i)\n", httpCode);
httpClient.end();
FREE(URL);
return;
vTaskDelete(NULL); //end this task so it will not take up resources
}

stream = httpClient.getStreamPtr();
Expand Down

0 comments on commit 91c3dde

Please sign in to comment.