< Previous by Date Date Index Next by Date >
  Thread Index Next in Thread >

[reSIProcate-users] DUM: death penalty for not calling setRegistrationPersistenceManager in ServerRegistration.cxx?



Throughout ServerRegistration.cxx, there is a lot of code that uses a local variable, database, like this:

RegistrationPersistenceManager *database = mDum.mRegistrationPersistenceManager;
...

  contacts = database->getContacts(mAor);
  database->unlockRecord(mAor);

This code will crash if database is NULL, that is, if mDum.mRegistrationPersistenceManager is NULL. The only way it ever gets set is for someone (i.e. the app) to call DialogUsageManager::setRegistrationPersistenceManager(). I'm not sure of the use of this, and maybe it simply doesn't make sense to be doing any registrations without having called this accessor first, but even in that case, perhaps the uses of it should assert or throw an exception instead of just assuming the pointer is valid and using it. For my purposes, I simply wrapped all uses of database in "if (database) ..." which may not be the absolutely correct thing to do. I can post or email the diffs as directed if you all think what I did is appropriate. Otherwise, I just thought I'd mention it.

regards,

-John Gregg