summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjörn Stenberg <bjorn@haxx.se>2002-11-14 22:17:41 +0000
committerBjörn Stenberg <bjorn@haxx.se>2002-11-14 22:17:41 +0000
commita69e98d7cc96a2046cccb9e019f20f47bd9eee15 (patch)
treec28b9e0adf6d5456f560023c6c8b8cd3b5addb09
parent4cde17d1ca7571055b0586fee78bf71765ab32ff (diff)
Added check to avoid FAT sector 0 panic.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2850 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/drivers/fat.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/firmware/drivers/fat.c b/firmware/drivers/fat.c
index ef6ee8b2ef..5cc47be2cf 100644
--- a/firmware/drivers/fat.c
+++ b/firmware/drivers/fat.c
@@ -981,7 +981,8 @@ int fat_truncate(struct fat_file *file)
next = get_next_cluster(last);
update_fat_entry(last,0);
}
- update_fat_entry(file->lastcluster,FAT_EOF_MARK);
+ if (file->lastcluster)
+ update_fat_entry(file->lastcluster,FAT_EOF_MARK);
return 0;
}