Fix null handling to prevent NullReferenceException

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
This commit is contained in:
Jack Ye 2025-10-16 20:40:36 +08:00 committed by GitHub
parent 6d2be7a3a1
commit d8a4bbc73a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -380,8 +380,9 @@ namespace Flow.Launcher.Plugin.SharedCommands
/// </summary>
public static bool IsValidFileName(string name)
{
if (string.IsNullOrWhiteSpace(name)) return false;
if (IsReservedName(name)) return false;
if (name.IndexOfAny(Path.GetInvalidFileNameChars()) >= 0 || string.IsNullOrWhiteSpace(name))
if (name.IndexOfAny(Path.GetInvalidFileNameChars()) >= 0)
{
return false;
}