aboutsummaryrefslogtreecommitdiff
path: root/src/SFileAddFile.cpp
diff options
context:
space:
mode:
authorLadislav <Zezula>2014-01-12 13:04:30 +0100
committerLadislav <Zezula>2014-01-12 13:04:30 +0100
commita70a9800220851555272cab6a61e2bb00b867ffb (patch)
tree1c74cf6c4d00080da0c167ea4b30a0f6f290a2a6 /src/SFileAddFile.cpp
parent8bf322b6117a99136d978c192f845c45efe47efa (diff)
+ Fixed crash when ha == NULL in SFileCreateFile
Diffstat (limited to 'src/SFileAddFile.cpp')
-rw-r--r--src/SFileAddFile.cpp19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/SFileAddFile.cpp b/src/SFileAddFile.cpp
index fdc1524..1fa5873 100644
--- a/src/SFileAddFile.cpp
+++ b/src/SFileAddFile.cpp
@@ -685,16 +685,19 @@ bool WINAPI SFileCreateFile(
nError = ERROR_INVALID_PARAMETER;
// Don't allow to add file if the MPQ is open for read only
- if(ha->dwFlags & MPQ_FLAG_READ_ONLY)
- nError = ERROR_ACCESS_DENIED;
+ if(nError == ERROR_SUCCESS)
+ {
+ if(ha->dwFlags & MPQ_FLAG_READ_ONLY)
+ nError = ERROR_ACCESS_DENIED;
- // Don't allow to add a file under pseudo-file name
- if(IsPseudoFileName(szArchivedName, NULL))
- nError = ERROR_INVALID_PARAMETER;
+ // Don't allow to add a file under pseudo-file name
+ if(IsPseudoFileName(szArchivedName, NULL))
+ nError = ERROR_INVALID_PARAMETER;
- // Don't allow to add any of the internal files
- if(IsInternalMpqFileName(szArchivedName))
- nError = ERROR_INTERNAL_FILE;
+ // Don't allow to add any of the internal files
+ if(IsInternalMpqFileName(szArchivedName))
+ nError = ERROR_INTERNAL_FILE;
+ }
// Perform validity check of the MPQ flags
if(nError == ERROR_SUCCESS)