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

refactor: ♻️ ModManifest - Added type checks #163

Merged
merged 1 commit into from
Mar 2, 2023
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
12 changes: 10 additions & 2 deletions addons/mod_loader/classes/mod_manifest.gd
Original file line number Diff line number Diff line change
Expand Up @@ -218,17 +218,25 @@ static func is_mod_id_valid(original_mod_id: String, check_mod_id: String, type
return true


# Returns an empty String if the key does not exist
# Returns an empty String if the key does not exist or is not type of String
static func _get_string_from_dict(dict: Dictionary, key: String) -> String:
if not dict.has(key):
return ""

if not dict[key] is String:
return ""

return dict[key]


# Returns an empty Array if the key does not exist
# Returns an empty Array if the key does not exist or is not type of Array
static func _get_array_from_dict(dict: Dictionary, key: String) -> Array:
if not dict.has(key):
return []

if not dict[key] is Array:
return []

return dict[key]


Expand Down