aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/core/basetypes/MCData.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/core/basetypes/MCData.cpp b/src/core/basetypes/MCData.cpp
index be4497a7..d9f14efa 100644
--- a/src/core/basetypes/MCData.cpp
+++ b/src/core/basetypes/MCData.cpp
@@ -721,10 +721,14 @@ void Data::importSerializable(HashMap * serializable)
ErrorCode Data::writeToFile(String * filename)
{
FILE * f = fopen(filename->fileSystemRepresentation(), "wb");
+ if (f == NULL) {
+ return ErrorFile;
+ }
size_t result = fwrite(bytes(), length(), 1, f);
if (result == 0) {
return ErrorFile;
}
+ fclose(f);
return ErrorNone;
}