Skip to content

Commit

Permalink
Merge pull request #942 from OpenShot/fix-null-nodes-json
Browse files Browse the repository at this point in the history
Ignore NULL nodes in JSON arrays (clips, effects).
  • Loading branch information
jonoomph committed Oct 7, 2023
2 parents 95eccaf + 4af8092 commit 2034f45
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Clip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down
10 changes: 10 additions & 0 deletions src/Timeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit 2034f45

Please sign in to comment.