summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--recovery.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/recovery.cpp b/recovery.cpp
index cfca9df6f..725976f9d 100644
--- a/recovery.cpp
+++ b/recovery.cpp
@@ -526,10 +526,12 @@ finish_recovery() {
if (has_cache) {
LOGI("Saving locale \"%s\"\n", locale);
FILE* fp = fopen_path(LOCALE_FILE, "w");
- fwrite(locale, 1, len, fp);
- fflush(fp);
- fsync(fileno(fp));
- check_and_fclose(fp, LOCALE_FILE);
+ if (fp != NULL) {
+ fwrite(locale, 1, len, fp);
+ fflush(fp);
+ fsync(fileno(fp));
+ check_and_fclose(fp, LOCALE_FILE);
+ }
}
}