summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;
}