use non-throwing test for presence of Target
authorMichael Andres <ma@suse.de>
Wed, 24 Sep 2008 11:37:11 +0000 (11:37 +0000)
committerMichael Andres <ma@suse.de>
Wed, 24 Sep 2008 11:37:11 +0000 (11:37 +0000)
zypp/RepoManager.cc

index 1aee31a..19c25a7 100644 (file)
@@ -109,11 +109,12 @@ namespace zypp
     knownReposPath        = Pathname::assertprefix( root_r, ZConfig::instance().knownReposPath() );
     knownServicesPath     = Pathname::assertprefix( root_r, ZConfig::instance().knownServicesPath() );
     probe                 = ZConfig::instance().repo_add_probe();
-    try
+
+    if ( getZYpp()->getTarget() )
     {
       servicesTargetDistro = getZYpp()->target()->targetDistribution();
     }
-    catch (const Exception & e)
+    else
     {
       DBG << "Target not initialized, using an empty servicesTargetDistro." << endl;
     }