Null check order bug can throw NRE

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
This commit is contained in:
Jack Ye 2025-09-21 21:49:51 +08:00 committed by GitHub
parent e98f7907b8
commit 0b7c0408f8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -62,7 +62,7 @@ public static class RenameThing
public static void Rename(string NewFileName, FileSystemInfo oldInfo)
{
// if it's just whitespace and nothing else
if (string.IsNullOrEmpty(NewFileName.Trim()) || string.IsNullOrEmpty(NewFileName))
if (string.IsNullOrWhiteSpace(NewFileName))
{
Main.Context.API.ShowMsgError(Localize.plugin_explorer_field_may_not_be_empty());
return;