Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

handle some null/freed item cases to avoid bugs #2432

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading