Skip to content

Commit 7a5c177

Browse files
committed
Fixed issue where rootcastr was empty because size() hadn't yet been called. Moved get() after size() and also logging of the contents to prevent null pointer exception/panic
1 parent facd0ee commit 7a5c177

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/esp32FOTA.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,14 +364,14 @@ bool esp32FOTA::setupHTTP( const char* url )
364364
log_e("A strict security context has been set but no RootCA was provided");
365365
return false;
366366
}
367-
rootcastr = _cfg.root_ca->get();
368367
if( _cfg.root_ca->size() == 0 ) {
369368
log_e("A strict security context has been set but an empty RootCA was provided");
370-
log_e("rootcastr=%s", rootcastr);
371369
return false;
372370
}
371+
rootcastr = _cfg.root_ca->get();
373372
if( !rootcastr ) {
374373
log_e("Unable to get RootCA, aborting");
374+
log_e("rootcastr=%s", rootcastr);
375375
return false;
376376
}
377377
log_d("Loading root_ca.pem");

0 commit comments

Comments
 (0)