Skip to content

Commit

Permalink
fix: Validate savePath in WriteSnapshot method to prevent null arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
Bohicatv committed Feb 1, 2025
1 parent eea2de7 commit 7b7706e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Projects/Server/Serialization/GenericEntityPersistence.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,14 @@ public GenericEntityPersistence(string name, int priority, Serial minSerial, Ser

public override void WriteSnapshot(string savePath, HashSet<Type> typeSet)
{

if (string.IsNullOrEmpty(savePath))
{
throw new ArgumentNullException(nameof(savePath));
}

var path = Path.Combine(savePath, "snapshot");

var dir = Path.Combine(savePath, Name);
PathUtility.EnsureDirectory(dir);

Expand Down

0 comments on commit 7b7706e

Please sign in to comment.