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,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();