diff --git a/SabreTools.Helper/Dats/Partials/DatFile.Rebuild.cs b/SabreTools.Helper/Dats/Partials/DatFile.Rebuild.cs
index 10e4aff4..37a5e87c 100644
--- a/SabreTools.Helper/Dats/Partials/DatFile.Rebuild.cs
+++ b/SabreTools.Helper/Dats/Partials/DatFile.Rebuild.cs
@@ -474,7 +474,13 @@ namespace SabreTools.Helper.Dats
/// True if verification was a success, false otherwise
public bool VerifyDirectory(List inputs, string tempDir, bool hashOnly, string headerToCheckAgainst, Logger logger)
{
- // First create or clean the temp directory
+ // Check the temp directory exists
+ if (String.IsNullOrEmpty(tempDir))
+ {
+ tempDir = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());
+ }
+
+ // Then create or clean the temp directory
if (!Directory.Exists(tempDir))
{
Directory.CreateDirectory(tempDir);