From 86d4ee68e6b4f4e4b3e65924f62b888e5de08fc0 Mon Sep 17 00:00:00 2001 From: Socapex Date: Fri, 13 Feb 2015 00:11:12 -0500 Subject: [PATCH] UI: Do not save the project if null If the jsonData string is null, then there's nothing that should be written. Closes pull request #366 from Socapex/debugcrash --- obs/window-basic-main.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/obs/window-basic-main.cpp b/obs/window-basic-main.cpp index 085a1d2a5..596dd2b36 100644 --- a/obs/window-basic-main.cpp +++ b/obs/window-basic-main.cpp @@ -197,9 +197,14 @@ void OBSBasic::Save(const char *file) obs_data_t *saveData = GenerateSaveData(); const char *jsonData = obs_data_get_json(saveData); - /* TODO maybe a message box here? */ - if (!os_quick_write_utf8_file(file, jsonData, strlen(jsonData), false)) - blog(LOG_ERROR, "Could not save scene data to %s", file); + if (!!jsonData) { + /* TODO: maybe a message box here? */ + bool success = os_quick_write_utf8_file(file, jsonData, + strlen(jsonData), false); + if (!success) + blog(LOG_ERROR, "Could not save scene data to %s", + file); + } obs_data_release(saveData); }