Null safety checks.

This commit is contained in:
Michael Bucari-Tovo 2025-03-04 09:44:21 -07:00
parent 5f99e594d8
commit 88d3e5ff0c
2 changed files with 45 additions and 28 deletions

View file

@ -2,6 +2,7 @@
using DataLayer;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
namespace LibationUiBase.GridView
@ -47,9 +48,11 @@ namespace LibationUiBase.GridView
otherSet is not null &&
searchSet.Intersect(otherSet).Count() != searchSet.Count);
public static HashSet<IGridEntry>? FilterEntries(this IEnumerable<IGridEntry> entries, string searchString)
[return: NotNullIfNotNull(nameof(searchString))]
public static HashSet<IGridEntry>? FilterEntries(this IEnumerable<IGridEntry> entries, string? searchString)
{
if (string.IsNullOrEmpty(searchString)) return null;
if (string.IsNullOrEmpty(searchString))
return null;
var searchResultSet = SearchEngineCommands.Search(searchString);