fix(cpn): simulator crashes in SD browser (#5387)

This commit is contained in:
philmoz
2024-08-06 11:46:25 +10:00
committed by GitHub
parent 3c2048731f
commit e8aad3b33e
@@ -256,13 +256,17 @@ void RadioSdManagerPage::build(Window * window)
browser->setFileSelected([=](const char* path, const char* name, const char* fullpath) { browser->setFileSelected([=](const char* path, const char* name, const char* fullpath) {
preview->setFile(nullptr); preview->setFile(nullptr);
loading->hide(); loading->hide();
if (fullpath) {
auto ext = getFileExtension(fullpath); auto ext = getFileExtension(fullpath);
if (ext) {
if (strcasecmp(ext, ".bmp") == 0 || strcasecmp(ext, ".png") == 0 || if (strcasecmp(ext, ".bmp") == 0 || strcasecmp(ext, ".png") == 0 ||
strcasecmp(ext, ".jpg") == 0 || strcasecmp(ext, ".jpeg") == 0) { strcasecmp(ext, ".jpg") == 0 || strcasecmp(ext, ".jpeg") == 0) {
previewFilename = fullpath; previewFilename = fullpath;
loadPreview = 10; loadPreview = 10;
loading->show(); loading->show();
} }
}
}
}); });
browser->refresh(); browser->refresh();
} }