Skip to content

Commit

Permalink
fix: in the case a timeline-object resolves to nothing, fall back to …
Browse files Browse the repository at this point in the history
…default values
  • Loading branch information
nytamin committed Apr 25, 2022
1 parent d33f8e6 commit 0998f2b
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions apps/app/src/electron/IPCServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1968,6 +1968,17 @@ export class IPCServer
for (const o of part.timeline) {
const resolvedObj = resolvedTimeline.objects[o.obj.id]
if (resolvedObj) {
if (resolvedObj.resolved.instances.length === 0) {
// If the timeline object has no instances, this might be because there's something wrong with the timelineObject.
if (!Array.isArray(o.obj.enable)) {
if (o.obj.enable.while === undefined) {
if (typeof o.obj.enable.start === 'string') o.obj.enable.start = 0 // Fall back to a default value
if (typeof o.obj.enable.duration === 'string') o.obj.enable.duration = 1000 // Fall back to a default value
if (typeof o.obj.enable.end === 'string') o.obj.enable.end = 1000 // Fall back to a default value
}
}
}

o.resolved = {
instances: resolvedObj.resolved.instances.map<TimelineObjResolvedInstance>((i) => ({
start: i.start,
Expand Down

0 comments on commit 0998f2b

Please sign in to comment.