summaryrefslogtreecommitdiff
path: root/src/dalstorage.cpp
diff options
context:
space:
mode:
authorYohann Ferreira <bertram@cegetel.net>2005-12-29 22:39:28 +0000
committerYohann Ferreira <bertram@cegetel.net>2005-12-29 22:39:28 +0000
commit6f8cd5e267a27357a54cb35a44e4fedfc975c0f0 (patch)
tree6d4ddd578d177a68a30dcc87b27bcdfcc742c30e /src/dalstorage.cpp
parentf408b59ad69cd9877fd1a657109255545f677e37 (diff)
downloadmanaserv-6f8cd5e267a27357a54cb35a44e4fedfc975c0f0.tar.gz
manaserv-6f8cd5e267a27357a54cb35a44e4fedfc975c0f0.tar.bz2
manaserv-6f8cd5e267a27357a54cb35a44e4fedfc975c0f0.tar.xz
manaserv-6f8cd5e267a27357a54cb35a44e4fedfc975c0f0.zip
Fixing a bug in the Storage::getAccount() function that made the server crash when the first login had a bad password.
Diffstat (limited to 'src/dalstorage.cpp')
-rw-r--r--src/dalstorage.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/dalstorage.cpp b/src/dalstorage.cpp
index 5723a040..c0359754 100644
--- a/src/dalstorage.cpp
+++ b/src/dalstorage.cpp
@@ -158,7 +158,7 @@ DALStorage::close(void)
/**
* Get an account by user name.
*/
-Account*
+AccountPtr
DALStorage::getAccount(const std::string& userName)
{
// connect to the database (if not connected yet).
@@ -173,7 +173,7 @@ DALStorage::getAccount(const std::string& userName)
);
if (it != mAccounts.end()) {
- return (it->first).get();
+ return it->first;
}
using namespace dal;
@@ -190,7 +190,7 @@ DALStorage::getAccount(const std::string& userName)
// if the account is not even in the database then
// we have no choice but to return nothing.
if (accountInfo.isEmpty()) {
- return NULL;
+ return AccountPtr(NULL);
}
// create an Account instance
@@ -288,10 +288,10 @@ DALStorage::getAccount(const std::string& userName)
account->setCharacters(beings);
} // End if there are characters.
- return account.get();
+ return account;
}
catch (const DbSqlQueryExecFailure& e) {
- return NULL; // TODO: Throw exception here
+ return AccountPtr(NULL); // TODO: Throw exception here
}
}
@@ -303,6 +303,7 @@ void
DALStorage::addAccount(const AccountPtr& account)
{
if (account.get() == 0) {
+ LOG_WARN("Cannot add a NULL Account.", 0)
// maybe we should throw an exception instead
return;
}