Skip to content

Commit

Permalink
Fix incorrect condition for error filtering
Browse files Browse the repository at this point in the history
Fixes: godotengine#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.

(cherry picked from commit d81c9c3)
  • Loading branch information
nongvantinh authored and akien-mga committed Mar 11, 2024
1 parent 82d2375 commit ae6079d
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit ae6079d

Please sign in to comment.