From b42df97edd4b855141f10e21145d471fcc93cad0 Mon Sep 17 00:00:00 2001 From: "K. S. Ernest (iFIre) Lee" Date: Thu, 30 May 2019 09:08:37 -0700 Subject: Check error code before using FileAccess to create a preview and crashing. --- editor/editor_resource_preview.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'editor/editor_resource_preview.cpp') diff --git a/editor/editor_resource_preview.cpp b/editor/editor_resource_preview.cpp index 2baad8c904..6cca0a0ffa 100644 --- a/editor/editor_resource_preview.cpp +++ b/editor/editor_resource_preview.cpp @@ -203,7 +203,9 @@ void EditorResourcePreview::_generate_preview(Ref &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))); -- cgit v1.2.3