summaryrefslogtreecommitdiffstats
path: root/platform/macos/display_server_macos.mm
diff options
context:
space:
mode:
authorA Thousand Ships <96648715+AThousandShips@users.noreply.github.com>2024-04-27 11:56:39 +0200
committerA Thousand Ships <96648715+AThousandShips@users.noreply.github.com>2024-04-27 16:22:57 +0200
commit31e7ee63f21e7b86d41cdb724824d4dc0804f281 (patch)
treecd7146d05bd3ac5069083a1ca499f6662c4971b5 /platform/macos/display_server_macos.mm
parent6118592c6d88350d01f74faff6fd49754f84a7d0 (diff)
downloadredot-engine-31e7ee63f21e7b86d41cdb724824d4dc0804f281.tar.gz
Fix unsafe uses of `Callable.is_null()`
`Callable.is_null()` is not equivalent to `!Callable.is_valid()` and doesn't guarantee the call is valid.
Diffstat (limited to 'platform/macos/display_server_macos.mm')
-rw-r--r--platform/macos/display_server_macos.mm12
1 files changed, 6 insertions, 6 deletions
diff --git a/platform/macos/display_server_macos.mm b/platform/macos/display_server_macos.mm
index cfe925e79b..6461f50818 100644
--- a/platform/macos/display_server_macos.mm
+++ b/platform/macos/display_server_macos.mm
@@ -938,7 +938,7 @@ Error DisplayServerMacOS::dialog_show(String p_title, String p_description, Vect
button_pressed = int64_t(2 + (ret - NSAlertThirdButtonReturn));
}
- if (!p_callback.is_null()) {
+ if (p_callback.is_valid()) {
Variant ret;
Callable::CallError ce;
const Variant *args[1] = { &button_pressed };
@@ -1018,7 +1018,7 @@ Error DisplayServerMacOS::_file_dialog_with_options_show(const String &p_title,
String url;
url.parse_utf8([[[panel URL] path] UTF8String]);
files.push_back(url);
- if (!callback.is_null()) {
+ if (callback.is_valid()) {
if (p_options_in_cb) {
Variant v_result = true;
Variant v_files = files;
@@ -1047,7 +1047,7 @@ Error DisplayServerMacOS::_file_dialog_with_options_show(const String &p_title,
}
}
} else {
- if (!callback.is_null()) {
+ if (callback.is_valid()) {
if (p_options_in_cb) {
Variant v_result = false;
Variant v_files = Vector<String>();
@@ -1134,7 +1134,7 @@ Error DisplayServerMacOS::_file_dialog_with_options_show(const String &p_title,
url.parse_utf8([[[urls objectAtIndex:i] path] UTF8String]);
files.push_back(url);
}
- if (!callback.is_null()) {
+ if (callback.is_valid()) {
if (p_options_in_cb) {
Variant v_result = true;
Variant v_files = files;
@@ -1163,7 +1163,7 @@ Error DisplayServerMacOS::_file_dialog_with_options_show(const String &p_title,
}
}
} else {
- if (!callback.is_null()) {
+ if (callback.is_valid()) {
if (p_options_in_cb) {
Variant v_result = false;
Variant v_files = Vector<String>();
@@ -1222,7 +1222,7 @@ Error DisplayServerMacOS::dialog_input_text(String p_title, String p_description
String ret;
ret.parse_utf8([[input stringValue] UTF8String]);
- if (!p_callback.is_null()) {
+ if (p_callback.is_valid()) {
Variant v_result = ret;
Variant ret;
Callable::CallError ce;