Skip to content

Commit

Permalink
fix(cpn): simulator crashes in SD browser (#5387)
Browse files Browse the repository at this point in the history
  • Loading branch information
philmoz authored Aug 6, 2024
1 parent 3c20487 commit e8aad3b
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions radio/src/gui/colorlcd/radio/radio_sdmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,12 +256,16 @@ void RadioSdManagerPage::build(Window * window)
browser->setFileSelected([=](const char* path, const char* name, const char* fullpath) {
preview->setFile(nullptr);
loading->hide();
auto ext = getFileExtension(fullpath);
if (strcasecmp(ext, ".bmp") == 0 || strcasecmp(ext, ".png") == 0 ||
strcasecmp(ext, ".jpg") == 0 || strcasecmp(ext, ".jpeg") == 0) {
previewFilename = fullpath;
loadPreview = 10;
loading->show();
if (fullpath) {
auto ext = getFileExtension(fullpath);
if (ext) {
if (strcasecmp(ext, ".bmp") == 0 || strcasecmp(ext, ".png") == 0 ||
strcasecmp(ext, ".jpg") == 0 || strcasecmp(ext, ".jpeg") == 0) {
previewFilename = fullpath;
loadPreview = 10;
loading->show();
}
}
}
});
browser->refresh();
Expand Down

0 comments on commit e8aad3b

Please sign in to comment.