From da521ba3c02ff20d06eecd5b3025be7051d9b35f Mon Sep 17 00:00:00 2001 From: Timothy Baldridge Date: Tue, 5 Jan 2021 15:53:26 -0700 Subject: [PATCH] Ignore harmless constraint failures --- Wabbajack.Common/Patches.cs | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/Wabbajack.Common/Patches.cs b/Wabbajack.Common/Patches.cs index cb5b925f..78139fae 100644 --- a/Wabbajack.Common/Patches.cs +++ b/Wabbajack.Common/Patches.cs @@ -52,9 +52,15 @@ namespace Wabbajack.Common cmd.Parameters.AddWithValue("@patchSize", patch.Length); cmd.Parameters.AddWithValue("@patch", patch.ToArray()); - await cmd.ExecuteNonQueryAsync(); - - + try + { + await cmd.ExecuteNonQueryAsync(); + } + catch (SQLiteException ex) + { + if (!ex.Message.StartsWith("constraint exception")) + throw; + } await patch.CopyToAsync(output); } @@ -78,7 +84,16 @@ namespace Wabbajack.Common cmd.Parameters.AddWithValue("@patchSize", patchStream.Length); cmd.Parameters.AddWithValue("@patch", patchStream.ToArray()); - await cmd.ExecuteNonQueryAsync(); + try + { + await cmd.ExecuteNonQueryAsync(); + } + catch (SQLiteException ex) + { + if (!ex.Message.StartsWith("constraint exception")) + throw; + + } if (patchOutStream == null) return patchStream.Position;