fix(core): check if got NULL in all functions

This commit is contained in:
2022-12-29 17:22:50 +03:00
parent 6a927f4644
commit dd1d513f1e
3 changed files with 20 additions and 2 deletions
+6
View File
@@ -81,6 +81,9 @@ int shoppyou_save(Shoppyou *shoppyou) {
}
int shoppyou_open(Shoppyou *shoppyou, const char *path) {
if (path == NULL) {
return 1;
}
shoppyou->file = fopen(path, "rb");
if (shoppyou->file == NULL) {
return 1;
@@ -90,6 +93,9 @@ int shoppyou_open(Shoppyou *shoppyou, const char *path) {
}
int shoppyou_dump(Shoppyou *shoppyou, const char *path) {
if (path == NULL) {
return 1;
}
shoppyou->file = fopen(path, "wb");
if (shoppyou->file == NULL) {
return 1;