Skip to content

Commit 1aa906c

Browse files
author
Ladislav Zezula
committed
+ SFileAddListFile now returns proper error code if the file cannot be added.
1 parent 6ffbb6a commit 1aa906c

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/SFileListFile.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -452,12 +452,12 @@ static int SFileAddExternalListFile(
452452
int nError = ERROR_SUCCESS;
453453

454454
// Open the external list file
455-
if(SFileOpenFileEx(hMpq, szListFile, SFILE_OPEN_LOCAL_FILE, &hListFile))
456-
{
457-
// Add the data from the listfile to MPQ
458-
nError = SFileAddArbitraryListFile(ha, hListFile);
459-
SFileCloseFile(hListFile);
460-
}
455+
if(!SFileOpenFileEx(hMpq, szListFile, SFILE_OPEN_LOCAL_FILE, &hListFile))
456+
return GetLastError();
457+
458+
// Add the data from the listfile to MPQ
459+
nError = SFileAddArbitraryListFile(ha, hListFile);
460+
SFileCloseFile(hListFile);
461461
return nError;
462462
}
463463

@@ -524,9 +524,9 @@ int WINAPI SFileAddListFile(HANDLE hMpq, const char * szListFile)
524524
while(ha != NULL)
525525
{
526526
if(szListFile != NULL)
527-
SFileAddExternalListFile(ha, hMpq, szListFile);
527+
nError = SFileAddExternalListFile(ha, hMpq, szListFile);
528528
else
529-
SFileAddInternalListFile(ha, hMpq);
529+
nError = SFileAddInternalListFile(ha, hMpq);
530530

531531
// Also, add three special files to the listfile:
532532
// (listfile) itself, (attributes) and (signature)

0 commit comments

Comments
 (0)