Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/kornelski/7z.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'CPP/Common/MyWindows.cpp')
-rwxr-xr-xCPP/Common/MyWindows.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/CPP/Common/MyWindows.cpp b/CPP/Common/MyWindows.cpp
index 1283946c..f940fc8a 100755
--- a/CPP/Common/MyWindows.cpp
+++ b/CPP/Common/MyWindows.cpp
@@ -26,10 +26,13 @@ BSTR SysAllocStringByteLen(LPCSTR psz, UINT len)
return 0;
*(UINT *)p = len;
BSTR bstr = (BSTR)((UINT *)p + 1);
- memmove(bstr, psz, len);
- Byte *pb = ((Byte *)bstr) + len;
- for (int i = 0; i < sizeof(OLECHAR) * 2; i++)
- pb[i] = 0;
+ if (psz)
+ {
+ memmove(bstr, psz, len);
+ Byte *pb = ((Byte *)bstr) + len;
+ for (unsigned i = 0; i < sizeof(OLECHAR) * 2; i++)
+ pb[i] = 0;
+ }
return bstr;
}