Small part of r5515 adding null check to imsiGet

git-svn-id: http://wush.net/svn/range/software/public/subscriberRegistry/trunk@5741 19bc5d8c-e614-43d4-8b26-e1612bc8e597
This commit is contained in:
Kurtis Heimerl 2013-06-16 03:16:24 +00:00
parent 5456567895
commit a4511a33b6
1 changed files with 6 additions and 1 deletions

View File

@ -276,7 +276,12 @@ SubscriberRegistry::Status SubscriberRegistry::sqlUpdate(const char *stmt)
string SubscriberRegistry::imsiGet(string imsi, string key)
{
string name = imsi.substr(0,4) == "IMSI" ? imsi : "IMSI" + imsi;
return sqlQuery(key.c_str(), "sip_buddies", "name", imsi.c_str());
char *st = sqlQuery(key.c_str(), "sip_buddies", "name", imsi.c_str());
if (!st) {
LOG(WARNING) << "cannot get key " << key << " for username " << imsi;
return "";
}
return st;
}
bool SubscriberRegistry::imsiSet(string imsi, string key, string value)