sharandac / My-TTGO-Watch

A GUI named hedge for smartwatch like devices based on ESP32. Currently support for T-Watch2020 (V1,V2,V3), T-Watch2021, M5Paper, M5Core2 and native Linux support for testing.
GNU General Public License v2.0
524 stars 246 forks source link

Bad check in src/utils/uri_load/uri_load.cpp ...? #359

Closed asdf23 closed 2 years ago

asdf23 commented 2 years ago

Greetings, I noticed an odd thing. I cannot explain it. In the following lines of code for me httpCode is set to -1. Or perhaps that's just what I'm seeing from a log I set URI_LOAD_ERROR_LOG("httpCode: %d", httpCode); anyway I see a -1 but it is still entering this if block. I believe that the line should be something like if( httpCode != -1 && ... ) or just httpCode == HTTP_CODE_OK

Honestly I don't understand what is going on

int httpCode = download_client.GET();
URI_LOAD_ERROR_LOG("httpCode: %d", httpCode);   <-- show's -1
if ( httpCode > 0 && httpCode == HTTP_CODE_OK  ) {
    URI_LOAD_ERROR_LOG(" inside if");  <-- loop is entered !?
sharandac commented 2 years ago

Thank you for your feedback. You're right, that probably happened during development and got left behind. But normaly when httpCode is lower then 0, the condition is false. I'm still wondering. It will be fixed in the next version.