From 4af80925b2f237e820571559e10c8bc7bbb2a931 Mon Sep 17 00:00:00 2001 From: Jonathan Thomas Date: Sat, 7 Oct 2023 15:19:36 -0500 Subject: [PATCH] Ignore NULL nodes in JSON arrays (clips, effects). This can happen sometimes (for an unknown reason), and it currently crashes OpenShot when attempting to Export a video. --- src/Clip.cpp | 5 +++++ src/Timeline.cpp | 10 ++++++++++ 2 files changed, 15 insertions(+) diff --git a/src/Clip.cpp b/src/Clip.cpp index e6ae55634..1cced73af 100644 --- a/src/Clip.cpp +++ b/src/Clip.cpp @@ -1040,6 +1040,11 @@ void Clip::SetJsonValue(const Json::Value root) { // loop through effects for (const auto existing_effect : root["effects"]) { + // Skip NULL nodes + if (existing_effect.isNull()) { + continue; + } + // Create Effect EffectBase *e = NULL; if (!existing_effect["type"].isNull()) { diff --git a/src/Timeline.cpp b/src/Timeline.cpp index de51a5630..54135f134 100644 --- a/src/Timeline.cpp +++ b/src/Timeline.cpp @@ -1193,6 +1193,11 @@ void Timeline::SetJsonValue(const Json::Value root) { // loop through clips for (const Json::Value existing_clip : root["clips"]) { + // Skip NULL nodes + if (existing_clip.isNull()) { + continue; + } + // Create Clip Clip *c = new Clip(); @@ -1220,6 +1225,11 @@ void Timeline::SetJsonValue(const Json::Value root) { // loop through effects for (const Json::Value existing_effect :root["effects"]) { + // Skip NULL nodes + if (existing_effect.isNull()) { + continue; + } + // Create Effect EffectBase *e = NULL;