From 6f020ef155de094fd2cdf30ed8258e7fed07a2e8 Mon Sep 17 00:00:00 2001 From: William Wilgus Date: Fri, 14 Dec 2018 06:04:39 -0600 Subject: [PATCH] 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 --- apps/filetree.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/apps/filetree.c b/apps/filetree.c index 2570b46460..e45348dc18 100644 --- a/apps/filetree.c +++ b/apps/filetree.c @@ -436,6 +436,12 @@ int ft_enter(struct tree_context* c) 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 @@ int ft_enter(struct tree_context* c) } 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) {