Fix nil crash when clicking card with null abilitiesJson
card.get("abilitiesJson", "") returns null when the key exists but
the server sent null — the default only fires for absent keys.
Assigning null to a typed String variable throws in GDScript 4.
Use an explicit null check instead of relying on the dict default.
Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
@@ -3092,7 +3092,8 @@ func _on_hand_card_clicked(iid: String, _panel: PanelContainer) -> void:
|
||||
(_mode == Mode.ABILITY_TARGET and not _ability_card_id.is_empty()):
|
||||
_set_mode(Mode.NONE)
|
||||
# Parse abilitiesJson for the first Active ability.
|
||||
var abs_raw : String = card.get("abilitiesJson", "")
|
||||
var _abs_v = card.get("abilitiesJson")
|
||||
var abs_raw : String = "" if _abs_v == null else _abs_v
|
||||
if not abs_raw.is_empty():
|
||||
var parsed_variant : Array = JSON.parse_string(abs_raw)
|
||||
if parsed_variant is Array:
|
||||
|
||||
Reference in New Issue
Block a user