From 4a0d1ba2729f6b7a4ffbbc289ea48f01f8172899 Mon Sep 17 00:00:00 2001 From: sirherrbatka Date: Sun, 16 Mar 2014 17:06:11 +0100 Subject: [PATCH] do not cast and check multiple times --- apps/opencs/view/world/dialoguesubview.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/apps/opencs/view/world/dialoguesubview.cpp b/apps/opencs/view/world/dialoguesubview.cpp index 17b665d46..f0a4ac131 100644 --- a/apps/opencs/view/world/dialoguesubview.cpp +++ b/apps/opencs/view/world/dialoguesubview.cpp @@ -117,17 +117,20 @@ QWidget* CSVWorld::DialogueDelegateDispatcherProxy::getEditor() const void CSVWorld::DialogueDelegateDispatcherProxy::tableMimeDataDropped(const std::vector& data, const CSMDoc::Document* document) { + QLineEdit* lineEdit = qobject_cast(mEditor); + { + if (!lineEdit or !mIndexWrapper.get()) + { + return; + } + } for (unsigned i = 0; i < data.size(); ++i) { if (mDisplay == CSMWorld::TableMimeData::convertEnums(data[i].getType())) { - QLineEdit* lineEdit = qobject_cast(mEditor); - if (lineEdit && mIndexWrapper.get()) - { - emit tableMimeDataDropped(mEditor, mIndexWrapper->mIndex, data[i], document); - emit editorDataCommited(mEditor, mIndexWrapper->mIndex, mDisplay); - break; - } + emit tableMimeDataDropped(mEditor, mIndexWrapper->mIndex, data[i], document); + emit editorDataCommited(mEditor, mIndexWrapper->mIndex, mDisplay); + break; } } }