add a detection for corrupt db

Signed-off-by: Mattias Andrée <maandree@operamail.com>