diff options
author | William Wilgus <me.theuser@yahoo.com> | 2018-12-14 06:04:39 -0600 |
---|---|---|
committer | William Wilgus <me.theuser@yahoo.com> | 2018-12-14 06:09:38 -0600 |
commit | 6f020ef155de094fd2cdf30ed8258e7fed07a2e8 (patch) | |
tree | e2f7b82cac5c1b460be5c7dd6b73f2e4d059c935 /apps | |
parent | 3f110daf3032187c052a6e3c1b05d01d1a4582d0 (diff) | |
download | rockbox-6f020ef155de094fd2cdf30ed8258e7fed07a2e8.tar.gz rockbox-6f020ef155de094fd2cdf30ed8258e7fed07a2e8.zip |
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
Diffstat (limited to 'apps')
-rw-r--r-- | apps/filetree.c | 12 |
1 files changed, 12 insertions, 0 deletions
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) | |||
436 | int rc = GO_TO_PREVIOUS; | 436 | int rc = GO_TO_PREVIOUS; |
437 | char buf[MAX_PATH]; | 437 | char buf[MAX_PATH]; |
438 | struct entry* file = tree_get_entry_at(c, c->selected_item); | 438 | struct entry* file = tree_get_entry_at(c, c->selected_item); |
439 | if (!file) | ||
440 | { | ||
441 | splashf(HZ, str(LANG_READ_FAILED), str(LANG_UNKNOWN)); | ||
442 | return rc; | ||
443 | } | ||
444 | |||
439 | int file_attr = file->attr; | 445 | int file_attr = file->attr; |
440 | int len; | 446 | int len; |
441 | 447 | ||
@@ -680,6 +686,12 @@ int ft_enter(struct tree_context* c) | |||
680 | } | 686 | } |
681 | 687 | ||
682 | struct entry* file = tree_get_entry_at(c, c->selected_item); | 688 | struct entry* file = tree_get_entry_at(c, c->selected_item); |
689 | if (!file) | ||
690 | { | ||
691 | splashf(HZ, str(LANG_READ_FAILED), str(LANG_UNKNOWN)); | ||
692 | return rc; | ||
693 | } | ||
694 | |||
683 | plugin = filetype_get_plugin(file); | 695 | plugin = filetype_get_plugin(file); |
684 | if (plugin) | 696 | if (plugin) |
685 | { | 697 | { |