there seem to be cases where the background service/process has been killed and so the database is not open, and the query returns null. 

i know this cateogrizes as defensive, but at this point, i just wanted to avoid an NPE here that can happen in complex situations that are very hard to nail down right now.