Fix SQL NPE when sql isn't enabled.