Scripting: Fix potential crash if a bucket can't be opened

This commit is contained in:
Vicki Pfau 2023-03-02 21:28:16 -08:00
parent ceb66b133f
commit 30fc000734
1 changed files with 6 additions and 0 deletions

View File

@ -307,6 +307,9 @@ bool mScriptStorageBucketFlush(struct mScriptStorageBucket* bucket) {
char path[PATH_MAX];
mScriptStorageGetBucketPath(bucket->name, path);
struct VFile* vf = VFileOpen(path, O_WRONLY | O_CREAT | O_TRUNC);
if (!vf) {
return false;
}
return _mScriptStorageBucketFlushVF(bucket, vf);
}
@ -329,6 +332,9 @@ bool mScriptStorageSaveBucket(struct mScriptContext* context, const char* bucket
char path[PATH_MAX];
mScriptStorageGetBucketPath(bucketName, path);
struct VFile* vf = VFileOpen(path, O_WRONLY | O_CREAT | O_TRUNC);
if (!vf) {
return false;
}
return mScriptStorageSaveBucketVF(context, bucketName, vf);
}