Skip to content

Commit

Permalink
Add additional safety checks
Browse files Browse the repository at this point in the history
  • Loading branch information
Jowan-Spooner committed Jul 2, 2024
1 parent 39ba323 commit b9f07a1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 2 additions & 2 deletions addons/dialogic/Modules/Character/subsystem_portraits.gd
Original file line number Diff line number Diff line change
Expand Up @@ -554,8 +554,8 @@ func leave_all_characters(animation_name:="", animation_length:=0.0, animation_w
## Return `null` if the [param character] is not part of the scene.
func get_character_node(character: DialogicCharacter) -> Node:
if is_character_joined(character):
return dialogic.current_state_info['portraits'][character.resource_path].node

if is_instance_valid(dialogic.current_state_info['portraits'][character.resource_path].node):
return dialogic.current_state_info['portraits'][character.resource_path].node
return null


Expand Down
3 changes: 1 addition & 2 deletions addons/dialogic/Modules/Voice/subsystem_voice.gd
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@ func _ready() -> void:
## Whether the current event is a text event and has a voice
## event before it.
func is_voiced(index: int) -> bool:
if dialogic.current_timeline_events[index] is DialogicTextEvent:

if index > 0 and dialogic.current_timeline_events[index] is DialogicTextEvent:
if dialogic.current_timeline_events[index-1] is DialogicVoiceEvent:
return true

Expand Down

0 comments on commit b9f07a1

Please sign in to comment.