ldb: avoid NULL deref in ldb_db_compare