Commits

Christoph Cullmann  committed 92c0a1b

potential nullpointer factory problem solved

svn path=/trunk/kdelibs/interfaces/ktexteditor/; revision=157912

  • Participants
  • Parent commits 83af292

Comments (0)

Files changed (1)

File ktexteditor/ktexteditor.cpp

 
 Editor *KTextEditor::createEditor ( const char* libname, QWidget *parentWidget, const char *widgetName, QObject *parent, const char *name )
 {
-  if ( KParts::Factory *factory = static_cast<KParts::Factory *>(KLibLoader::self()->factory( libname )->qt_cast ("KParts::Factory")) )
-  { 
-    if ( QObject *obj = factory->createPart( parentWidget, widgetName, parent, name, "KTextEditor::Editor" ) )    
-      return static_cast<Editor *>(obj->qt_cast ("KTextEditor::Editor"));
+  if ( KLibFactory *tmpFactory = KLibLoader::self()->factory( libname ) )
+  {   
+    if ( KParts::Factory *factory = static_cast<KParts::Factory *>(tmpFactory->qt_cast ("KParts::Factory")) )
+    {
+      if ( QObject *obj = factory->createPart( parentWidget, widgetName, parent, name, "KTextEditor::Editor" ) )    
+        return static_cast<Editor *>(obj->qt_cast ("KTextEditor::Editor"));
+    }
   }
                
   return 0;