Skip to content

Commit

Permalink
Merge pull request #2432 from Invertex/fix-timeline-window-content-mi…
Browse files Browse the repository at this point in the history
…smatch-bug

handle some null/freed item cases to avoid bugs
  • Loading branch information
zaknafean authored Oct 16, 2024
2 parents 880a3e2 + ad26128 commit f27d079
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,11 @@ func batch_events(array: Array, size: int, batch_number: int) -> Array:
var opener_events_stack := []

func load_batch(data:Array) -> void:
var current_batch: Array = _batches.pop_front()
# Don't try to cast it to Array immedietly, as the item may have become null and will throw a useless error
var current_batch = _batches.pop_front()
if current_batch:
for i in current_batch:
var current_batch_items: Array = current_batch
for i in current_batch_items:
if i is DialogicEndBranchEvent:
create_end_branch_event(%Timeline.get_child_count(), opener_events_stack.pop_back())
else:
Expand All @@ -134,9 +136,9 @@ func _on_batch_loaded() -> void:
return

if opener_events_stack:

for ev in opener_events_stack:
create_end_branch_event(%Timeline.get_child_count(), ev)
if is_instance_valid(ev):
create_end_branch_event(%Timeline.get_child_count(), ev)

opener_events_stack = []
indent_events()
Expand Down

0 comments on commit f27d079

Please sign in to comment.