File tree Expand file tree Collapse file tree 1 file changed +19
-3
lines changed Expand file tree Collapse file tree 1 file changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -2736,9 +2736,25 @@ public async Task SearchAsync(FolderSearch search)
27362736 await ApplyFilesAndFoldersChangesAsync ( ) ;
27372737 EmptyTextType = EmptyTextType . None ;
27382738
2739- SearchHeaderTitle = ! string . IsNullOrEmpty ( search . Query )
2740- ? string . Format ( Strings . SearchResultsFor . GetLocalizedResource ( ) , search . Query )
2741- : string . Empty ;
2739+ if ( ! string . IsNullOrEmpty ( search . Query ) )
2740+ {
2741+ try
2742+ {
2743+ // Try to format the localized string with the search query
2744+ SearchHeaderTitle = string . Format ( Strings . SearchResultsFor . GetLocalizedResource ( ) , search . Query ) ;
2745+ }
2746+ catch ( FormatException ex )
2747+ {
2748+ // Handle malformed localized format strings (e.g., incorrect placeholders in translation)
2749+ // Fallback to a safe default format
2750+ App . Logger . LogWarning ( ex , "Malformed localized format string for SearchResultsFor. Using fallback format." ) ;
2751+ SearchHeaderTitle = $ "Search results for \" { search . Query } \" ";
2752+ }
2753+ }
2754+ else
2755+ {
2756+ SearchHeaderTitle = string . Empty ;
2757+ }
27422758
27432759 if ( SearchIconBitmapImage is null )
27442760 SearchIconBitmapImage ??= await UIHelpers . GetSearchIconResource ( ) ;
You can’t perform that action at this time.
0 commit comments