summaryrefslogtreecommitdiffstats
path: root/platform/windows
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/windows
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/windows')
-rw-r--r--platform/windows/display_server_windows.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/platform/windows/display_server_windows.cpp b/platform/windows/display_server_windows.cpp
index b6b713687f..ebae00017b 100644
--- a/platform/windows/display_server_windows.cpp
+++ b/platform/windows/display_server_windows.cpp
@@ -545,7 +545,7 @@ Error DisplayServerWindows::_file_dialog_with_options_show(const String &p_title
result->Release();
}
}
- if (!p_callback.is_null()) {
+ if (p_callback.is_valid()) {
if (p_options_in_cb) {
Variant v_result = true;
Variant v_files = file_names;
@@ -574,7 +574,7 @@ Error DisplayServerWindows::_file_dialog_with_options_show(const String &p_title
}
}
} else {
- if (!p_callback.is_null()) {
+ if (p_callback.is_valid()) {
if (p_options_in_cb) {
Variant v_result = false;
Variant v_files = Vector<String>();
@@ -2556,7 +2556,7 @@ Error DisplayServerWindows::dialog_show(String p_title, String p_description, Ve
int button_pressed;
if (task_dialog_indirect && SUCCEEDED(task_dialog_indirect(&config, &button_pressed, nullptr, nullptr))) {
- if (!p_callback.is_null()) {
+ if (p_callback.is_valid()) {
Variant button = button_pressed;
const Variant *args[1] = { &button };
Variant ret;
@@ -4591,7 +4591,7 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
}
if (rect_changed) {
- if (!window.rect_changed_callback.is_null()) {
+ if (window.rect_changed_callback.is_valid()) {
window.rect_changed_callback.call(Rect2i(window.last_pos.x, window.last_pos.y, window.width, window.height));
}
@@ -4803,7 +4803,7 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
files.push_back(file);
}
- if (files.size() && !windows[window_id].drop_files_callback.is_null()) {
+ if (files.size() && windows[window_id].drop_files_callback.is_valid()) {
windows[window_id].drop_files_callback.call(files);
}
} break;