filetree.c add checks for invalid file entries
Admittedly I can not really think of a reason this would occur
in normal use but if it does it'll result in a crash so
better safe than sorry
Change-Id: I593652bb658475bbd9a18026243c02524f5e7ccb
diff --git a/apps/filetree.c b/apps/filetree.c
index 2570b46..e45348d 100644
--- a/apps/filetree.c
+++ b/apps/filetree.c
@@ -436,6 +436,12 @@
int rc = GO_TO_PREVIOUS;
char buf[MAX_PATH];
struct entry* file = tree_get_entry_at(c, c->selected_item);
+ if (!file)
+ {
+ splashf(HZ, str(LANG_READ_FAILED), str(LANG_UNKNOWN));
+ return rc;
+ }
+
int file_attr = file->attr;
int len;
@@ -680,6 +686,12 @@
}
struct entry* file = tree_get_entry_at(c, c->selected_item);
+ if (!file)
+ {
+ splashf(HZ, str(LANG_READ_FAILED), str(LANG_UNKNOWN));
+ return rc;
+ }
+
plugin = filetype_get_plugin(file);
if (plugin)
{