summaryrefslogtreecommitdiff
path: root/src/window.cpp
diff options
context:
space:
mode:
authorDidac Perez Parera <perez.didac@gmail.com>2021-04-10 02:19:14 -0700
committerGitHub <noreply@github.com>2021-04-10 10:19:14 +0100
commit0cb99c55233e8e29ba33ae49002f9453d55d600c (patch)
tree4558d47a3bc0f6e3ced6856a033a8380d805668c /src/window.cpp
parentc64b0946e882ca6ff199834853696e3e0c239b04 (diff)
downloadopenttd-0cb99c55233e8e29ba33ae49002f9453d55d600c.tar.xz
Codechange: nullptr deletion in DeleteWindowById (#8941)
Diffstat (limited to 'src/window.cpp')
-rw-r--r--src/window.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/window.cpp b/src/window.cpp
index e164d0d4a..2216fb241 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -1165,8 +1165,7 @@ Window *FindWindowByClass(WindowClass cls)
void DeleteWindowById(WindowClass cls, WindowNumber number, bool force)
{
Window *w = FindWindowById(cls, number);
- if (force || w == nullptr ||
- (w->flags & WF_STICKY) == 0) {
+ if (w != nullptr && (force || (w->flags & WF_STICKY) == 0)) {
delete w;
}
}