The result of a downcast to a wrong dynamic type is undefined according to the C++ standard. Wrong casts were detected at goldendict start by GCC's -fsanitize=undefined option. This commit fixes #974.
(QImage don't handle such images)