diff options
author | Brodie Thiesfield <brofield@users.noreply.github.com> | 2016-07-24 08:30:56 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-07-24 08:30:56 +0300 |
commit | 03e27b27901c8e12fef6daeddc18a9a3e217dea4 (patch) | |
tree | 3543342df874453699b1ecf3158f1edeb5dbdcc3 | |
parent | e850d4e1cae65ee10f60992c5a576dce7fe35220 (diff) | |
parent | 66a7ead100f7f41c14afc0ab528a46f928a9f3d8 (diff) |
Merge pull request #20 from leokoppel/master
Fix failure on loading empty file
-rw-r--r-- | SimpleIni.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/SimpleIni.h b/SimpleIni.h index aee5bee..b0cad33 100644 --- a/SimpleIni.h +++ b/SimpleIni.h @@ -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)) { |