From d81c9c32c5ea4e91de3038b30c4a7a9ab78b7481 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?N=C3=B4ng=20V=C4=83n=20T=C3=ACnh?= Date: Wed, 31 Jan 2024 23:01:37 +0700 Subject: [PATCH] Fix incorrect condition for error filtering Fixes: #87643 The original condition stopped immediately after checking for 'searchText' in the 'Message' field, resulting in premature termination of subsequent checks. This fix ensures that all relevant conditions are appropriately evaluated before determining the filtering outcome. Additionally, accompanying changes include improved code readability for better comprehension. This adjustment enhances the maintainability of the error filtering mechanism, contributing to a more robust codebase overall. --- .../GodotTools/Build/BuildProblemsView.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/modules/mono/editor/GodotTools/GodotTools/Build/BuildProblemsView.cs b/modules/mono/editor/GodotTools/GodotTools/Build/BuildProblemsView.cs index 93b5a6c7f819..d62eb3ce9e8c 100644 --- a/modules/mono/editor/GodotTools/GodotTools/Build/BuildProblemsView.cs +++ b/modules/mono/editor/GodotTools/GodotTools/Build/BuildProblemsView.cs @@ -308,14 +308,14 @@ private bool ShouldDisplayDiagnostic(BuildDiagnostic diagnostic) return false; string searchText = _searchBox.Text; - if (!string.IsNullOrEmpty(searchText) && - (!diagnostic.Message.Contains(searchText, StringComparison.OrdinalIgnoreCase) || - !(diagnostic.File?.Contains(searchText, StringComparison.OrdinalIgnoreCase) ?? false))) - { - return false; - } - - return true; + if (string.IsNullOrEmpty(searchText)) + return true; + if (diagnostic.Message.Contains(searchText, StringComparison.OrdinalIgnoreCase)) + return true; + if (diagnostic.File?.Contains(searchText, StringComparison.OrdinalIgnoreCase) ?? false) + return true; + + return false; } private Color? GetProblemItemColor(BuildDiagnostic diagnostic)