From 461fb98a8c003fc6d19a9ea52d32319f9a40b287 Mon Sep 17 00:00:00 2001 From: redstrate <54911369+redstrate@users.noreply.github.com> Date: Fri, 5 Feb 2021 19:50:31 -0500 Subject: [PATCH] Quit early if cannot write to thumbnail cache --- tools/common/src/commoneditor.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/common/src/commoneditor.cpp b/tools/common/src/commoneditor.cpp index db6cd70..936dee7 100755 --- a/tools/common/src/commoneditor.cpp +++ b/tools/common/src/commoneditor.cpp @@ -1125,6 +1125,10 @@ void CommonEditor::save_thumbnail_cache() { GFXBuffer* thumbnailBuffer = engine->get_gfx()->create_buffer(nullptr, thumbnail_resolution * thumbnail_resolution * 4, false, GFXBufferUsage::Storage); FILE* file = fopen("thumbnail-cache", "wb"); + if(file == nullptr) { + console::error(System::Core, "Failed to write thumbnail cache!"); + return; + } int size = asset_thumbnails.size(); fwrite(&size, sizeof(int), 1, file);