Fix NPE on wifi connect

For some weird reason database is not opened and when wifi connection is established SLS crashes because mDb is null, adding this little check solves it.