Skip to content

Commit 95b55b2

Browse files
committed
Throw error *before* writing to the index file.
1 parent aa2c760 commit 95b55b2

File tree

1 file changed

+6
-4
lines changed
  • xivModdingFramework/SqPack/FileTypes

1 file changed

+6
-4
lines changed

xivModdingFramework/SqPack/FileTypes/Index.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1854,6 +1854,12 @@ await Task.Run(() =>
18541854
{
18551855
found = true;
18561856
oldOffset = br.ReadInt32();
1857+
1858+
if (oldOffset == 0)
1859+
{
1860+
throw new Exception("Cannot update index information for file with null data offset.");
1861+
}
1862+
18571863
bw.BaseStream.Seek(br.BaseStream.Position - 4, SeekOrigin.Begin);
18581864
uint uOffset = (uint)(offset / 8);
18591865
bw.Write(uOffset);
@@ -1879,10 +1885,6 @@ await Task.Run(() =>
18791885
throw new Exception("Cannot update index information for non-existent file.");
18801886
}
18811887

1882-
if(oldOffset == 0)
1883-
{
1884-
throw new Exception("Cannot update index information for file with null data offset.");
1885-
}
18861888

18871889
return oldOffset;
18881890
}

0 commit comments

Comments
 (0)