Fix crash in case of error

the QObject::parent() is 0