Fix some crashes.

A DB query had an extra ")", and a null check was missing.

Change-Id: I2f74510f870aad341d6bdd303ba7c2621025791f
2 files changed