Merge pull request #29319 from fire/preview_Crash

Check error code before using FileAccess to create a preview and cras…
This commit is contained in:
Rémi Verschelde 2019-05-30 18:35:06 +02:00 committed by GitHub
commit a2cf1c3d04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -203,7 +203,9 @@ void EditorResourcePreview::_generate_preview(Ref<ImageTexture> &r_texture, Ref<
if (has_small_texture) {
ResourceSaver::save(cache_base + "_small.png", r_small_texture);
}
FileAccess *f = FileAccess::open(cache_base + ".txt", FileAccess::WRITE);
Error err;
FileAccess *f = FileAccess::open(cache_base + ".txt", FileAccess::WRITE, &err);
ERR_FAIL_COND(err != OK);
f->store_line(itos(thumbnail_size));
f->store_line(itos(has_small_texture));
f->store_line(itos(FileAccess::get_modified_time(p_item.path)));