mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2026-01-01 22:20:52 +00:00
Fix possible InvalidOperationException on OldName
I don't know how it's possible, MSDN docs don't mention it, but since it's nullable, this should help.
This commit is contained in:
@@ -822,24 +822,28 @@ public static class ASF {
|
||||
ArgumentNullException.ThrowIfNull(sender);
|
||||
ArgumentNullException.ThrowIfNull(e);
|
||||
|
||||
if (string.IsNullOrEmpty(e.OldName)) {
|
||||
throw new InvalidOperationException(nameof(e.OldName));
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(e.OldFullPath)) {
|
||||
throw new InvalidOperationException(nameof(e.OldFullPath));
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(e.Name)) {
|
||||
throw new InvalidOperationException(nameof(e.Name));
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(e.FullPath)) {
|
||||
throw new InvalidOperationException(nameof(e.FullPath));
|
||||
}
|
||||
|
||||
await OnDeletedFile(e.OldName, e.OldFullPath).ConfigureAwait(false);
|
||||
await OnCreatedFile(e.Name, e.FullPath).ConfigureAwait(false);
|
||||
string? oldName = e.OldName;
|
||||
|
||||
if (string.IsNullOrEmpty(oldName)) {
|
||||
oldName = Path.GetFileName(e.OldFullPath);
|
||||
}
|
||||
|
||||
string? name = e.Name;
|
||||
|
||||
if (string.IsNullOrEmpty(name)) {
|
||||
name = Path.GetFileName(e.FullPath);
|
||||
}
|
||||
|
||||
await OnDeletedFile(oldName, e.OldFullPath).ConfigureAwait(false);
|
||||
await OnCreatedFile(name, e.FullPath).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
private static async Task RegisterBots() {
|
||||
|
||||
Reference in New Issue
Block a user