Permalink
Browse files

Merge pull request #20 from leokoppel/master

Fix failure on loading empty file
  • Loading branch information...
brofield committed Jul 24, 2016
2 parents e850d4e + 66a7ead commit 03e27b27901c8e12fef6daeddc18a9a3e217dea4
Showing with 4 additions and 4 deletions.
  1. +4 −4 SimpleIni.h
View
@@ -1416,10 +1416,6 @@ CSimpleIniTempl<SI_CHAR,SI_STRLESS,SI_CONVERTER>::LoadData(
{
SI_CONVERTER converter(m_bStoreIsUtf8);
if (a_uDataLen == 0) {
return SI_OK;
}
// consume the UTF-8 BOM if it exists
if (m_bStoreIsUtf8 && a_uDataLen >= 3) {
if (memcmp(a_pData, SI_UTF8_SIGNATURE, 3) == 0) {
@@ -1428,6 +1424,10 @@ CSimpleIniTempl<SI_CHAR,SI_STRLESS,SI_CONVERTER>::LoadData(
}
}
if (a_uDataLen == 0) {
return SI_OK;
}
// determine the length of the converted data
size_t uLen = converter.SizeFromStore(a_pData, a_uDataLen);
if (uLen == (size_t)(-1)) {

0 comments on commit 03e27b2

Please sign in to comment.