[PVR] Prevent crash on saved search #23193
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
When a PVR search is first created it is possible to hit Save which saves to the database and then performs a search. In this scenario the searchFilter parameter is not instantiated before OpenDialogSearch() is called leading to crash when it is referenced.
Check that the searchFilter is not empty before trying to populate it.
Motivation and context
This fixes a hard crash.
How has this been tested?
I could not determine the merit of the code that is causing the crash, but I assume it would handle a future change in the database persistance logic if the row id were to change. In the case of a new search this would not be an in issue.
Also for new searches the passed searchField parameter is also a class variable and the class variable is initialized in SetSearchFilter().
Tested on Windows 11 with current Omega build.
What is the effect on users?
The search is saved but it avoids a crash. It might be possible to remove save as an option on the first call but for users who repeat known searches on clients this would introduce an extra strep.
Screenshots (if appropriate):
Types of change
Checklist: