Don't crash when a database access fails

Database accesses can fail for many reasons, none of which merit a
crash. In particular, this should fix
https://bugzilla.redhat.com/show_bug.cgi?id=1065494

https://bugzilla.gnome.org/show_bug.cgi?id=740396