mirror of
https://github.com/haven1433/HexManiacAdvance.git
synced 2026-10-02 13:16:35 -05:00
provide a default value for recentFindResults to avoid null checks.
This commit is contained in:
@@ -42,7 +42,7 @@ namespace HavenSoft.Gen3Hex.ViewModel {
|
||||
|
||||
private readonly Dictionary<Func<ITabContent, ICommand>, EventHandler> forwardExecuteChangeNotifications;
|
||||
|
||||
private (IViewPort tab, int)[] recentFindResults;
|
||||
private (IViewPort tab, int)[] recentFindResults = new (IViewPort, int)[0];
|
||||
private int currentFindResultIndex;
|
||||
|
||||
public ICommand New => newCommand;
|
||||
@@ -208,7 +208,7 @@ namespace HavenSoft.Gen3Hex.ViewModel {
|
||||
find.CanExecute = CanAlwaysExecute;
|
||||
find.Execute = arg => FindExecuted((string)arg);
|
||||
|
||||
findPrevious.CanExecute = arg => recentFindResults?.Any(pair => pair.tab == SelectedTab) ?? false;
|
||||
findPrevious.CanExecute = arg => recentFindResults.Any(pair => pair.tab == SelectedTab);
|
||||
findPrevious.Execute = arg => {
|
||||
int attemptCount = 0;
|
||||
while (attemptCount < recentFindResults.Length) {
|
||||
@@ -222,7 +222,7 @@ namespace HavenSoft.Gen3Hex.ViewModel {
|
||||
}
|
||||
};
|
||||
|
||||
findNext.CanExecute = arg => recentFindResults?.Any(pair => pair.tab == SelectedTab) ?? false;
|
||||
findNext.CanExecute = arg => recentFindResults.Any(pair => pair.tab == SelectedTab);
|
||||
findNext.Execute = arg => {
|
||||
int attemptCount = 0;
|
||||
while (attemptCount < recentFindResults.Length) {
|
||||
|
||||
Reference in New Issue
Block a user