Skip to content

Commit 4af8092

Browse files
committed
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.
1 parent 95eccaf commit 4af8092

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

src/Clip.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1040,6 +1040,11 @@ void Clip::SetJsonValue(const Json::Value root) {
10401040

10411041
// loop through effects
10421042
for (const auto existing_effect : root["effects"]) {
1043+
// Skip NULL nodes
1044+
if (existing_effect.isNull()) {
1045+
continue;
1046+
}
1047+
10431048
// Create Effect
10441049
EffectBase *e = NULL;
10451050
if (!existing_effect["type"].isNull()) {

src/Timeline.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1193,6 +1193,11 @@ void Timeline::SetJsonValue(const Json::Value root) {
11931193

11941194
// loop through clips
11951195
for (const Json::Value existing_clip : root["clips"]) {
1196+
// Skip NULL nodes
1197+
if (existing_clip.isNull()) {
1198+
continue;
1199+
}
1200+
11961201
// Create Clip
11971202
Clip *c = new Clip();
11981203

@@ -1220,6 +1225,11 @@ void Timeline::SetJsonValue(const Json::Value root) {
12201225

12211226
// loop through effects
12221227
for (const Json::Value existing_effect :root["effects"]) {
1228+
// Skip NULL nodes
1229+
if (existing_effect.isNull()) {
1230+
continue;
1231+
}
1232+
12231233
// Create Effect
12241234
EffectBase *e = NULL;
12251235

0 commit comments

Comments
 (0)