Skip to content

Commit 2b359f2

Browse files
committed
Fix for a potential double-semaphore release error.
1 parent f904733 commit 2b359f2

File tree

1 file changed

+8
-2
lines changed
  • xivModdingFramework/SqPack/FileTypes

1 file changed

+8
-2
lines changed

xivModdingFramework/SqPack/FileTypes/Index.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1508,8 +1508,14 @@ public async Task<bool> AddFileDescriptor(string fullPath, long dataOffset, XivD
15081508
{
15091509
// File already exists. Just update the data offset.
15101510
_semaphoreSlim.Release();
1511-
await UpdateDataOffset(dataOffset, fullPath, updateCache);
1512-
await _semaphoreSlim.WaitAsync();
1511+
try
1512+
{
1513+
await UpdateDataOffset(dataOffset, fullPath, updateCache);
1514+
}
1515+
finally
1516+
{
1517+
await _semaphoreSlim.WaitAsync();
1518+
}
15131519
return false;
15141520
}
15151521
else if (iHash > uFileHash)

0 commit comments

Comments
 (0)