Commits

Anonymous committed 83af292

create** stuff enhanced

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

Comments (0)

Files changed (1)

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")) )
-  {
-    return static_cast<Editor *>(factory->createPart( parentWidget, widgetName, parent, name, "KTextEditor::Editor" )->qt_cast ("KTextEditor::Editor"));
+  { 
+    if ( QObject *obj = factory->createPart( parentWidget, widgetName, parent, name, "KTextEditor::Editor" ) )    
+      return static_cast<Editor *>(obj->qt_cast ("KTextEditor::Editor"));
   }
                
   return 0;
 {
   if ( KLibFactory *factory = KLibLoader::self()->factory( libname ) )
   {
-    return static_cast<Document *>(factory->create( parent, name, "KTextEditor::Document" )->qt_cast ("KTextEditor::Document"));
+    if ( QObject *obj = factory->create( parent, name, "KTextEditor::Document" ) )  
+      return static_cast<Document *>(obj->qt_cast ("KTextEditor::Document"));
   }
                
   return 0;
 {
   if ( KLibFactory *factory = KLibLoader::self()->factory( libname ) )
   {
-    return static_cast<Plugin *>(factory->create( parent, name, "KTextEditor::Plugin" )->qt_cast ("KTextEditor::Plugin"));
+    if ( QObject *obj = factory->create( parent, name, "KTextEditor::Plugin" ) )
+      return static_cast<Plugin *>(obj->qt_cast ("KTextEditor::Plugin"));
   }
                
   return 0;
 {
   if ( KLibFactory *factory = KLibLoader::self()->factory( libname ) )
   {
-    return static_cast<ViewPlugin *>(factory->create( parent, name, "KTextEditor::ViewPlugin" )->qt_cast ("KTextEditor::ViewPlugin"));
+    if ( QObject *obj = factory->create( parent, name, "KTextEditor::ViewPlugin" ) )
+      return static_cast<ViewPlugin *>(obj->qt_cast ("KTextEditor::ViewPlugin"));
   }
                
   return 0;