Skip to content

Commit 681e186

Browse files
authored
Merge pull request #769 from askamn/dev
Crashfix in UserDefault
2 parents df2cfe1 + 797a41b commit 681e186

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

core/base/CCUserDefault.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,9 @@ void UserDefault::flush()
484484
if (obs.length() > _curMapSize)
485485
{
486486
_rwmmap->unmap();
487-
_curMapSize <<= 1; // X2
487+
while (obs.length() > _curMapSize)
488+
_curMapSize <<= 1; // X2
489+
488490
posix_fsetsize(_fd, _curMapSize);
489491
_rwmmap->map(posix_fd2fh(_fd), 0, _curMapSize, error);
490492
}

0 commit comments

Comments
 (0)