diff options
author | Hoa V. DINH <dinh.viet.hoa@gmail.com> | 2015-03-12 20:51:46 -0700 |
---|---|---|
committer | Hoa V. DINH <dinh.viet.hoa@gmail.com> | 2015-03-12 20:51:55 -0700 |
commit | b8684c3b00bbdb5ac5bb3e1ee78e109528c4f15b (patch) | |
tree | b0631c83de983093d3adf70181279476c35ae41a /src/core | |
parent | ca990850f7a57a18373b84750541d6d5c5a18aae (diff) |
Fixed write data to file
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/basetypes/MCData.cpp | 4 |
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; } |