diff options
Diffstat (limited to 'src/dalstorage.cpp')
-rw-r--r-- | src/dalstorage.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/dalstorage.cpp b/src/dalstorage.cpp index 349666bf..c158fd53 100644 --- a/src/dalstorage.cpp +++ b/src/dalstorage.cpp @@ -656,8 +656,14 @@ void DALStorage::flush(AccountPtr const &account) sql2 << "select id from " << CHARACTERS_TBL_NAME << " where name = \"" << (*it)->getName() << "\";"; RecordSet const &charInfo = mDb->execSql(sql2.str()); - string_to<unsigned int> toUint; - (*it)->setID(toUint(charInfo(0, 0))); + if (charInfo.isEmpty()) { + (*it)->setID(1); + } + else + { + string_to<unsigned int> toUint; + (*it)->setID(toUint(charInfo(0, 0))); + } } else { sql3 << "update " << CHARACTERS_TBL_NAME << " set name = \"" << (*it)->getName() << "\", " |