backport from trunk (rev #9855)

fixed dlg_db_sync crash while in no-db mode
Credits to Nick Altmann