handle errors on source null implementation
authorJiri Srain <jsrain@suse.cz>
Fri, 27 Jan 2006 09:28:27 +0000 (09:28 +0000)
committerJiri Srain <jsrain@suse.cz>
Fri, 27 Jan 2006 09:28:27 +0000 (09:28 +0000)
zypp/source/SourceImpl.cc
zypp/source/SourceImpl.h

index d89a6ca3926e6b654d0f38562acdb5bfa7ec2d7d..6704a4f064344de750491eafaf1a394d8b8ac17f 100644 (file)
@@ -70,6 +70,8 @@ namespace zypp
     const Pathname SourceImpl::provideFile(const Pathname & file_r,
                                           const unsigned media_nr)
     {
+      if (_media == 0)
+       ZYPP_THROW(Exception("Source not initialized properly"));
       _media->provideFile (file_r);
       return _media->localPath (file_r);
     }
@@ -79,6 +81,8 @@ namespace zypp
                                          const unsigned media_nr,
                                          const bool recursive)
     {
+      if (_media == 0)
+       ZYPP_THROW(Exception("Source not initialized properly"));
       if (recursive)
        _media->provideDirTree(path_r);
       else
index 99951d4d4dee1aa8b590f8b8858b9dc11116f738..ce7f36fe49a98c898a8a9bf9df850f0462929b16 100644 (file)
@@ -64,11 +64,21 @@ namespace zypp
       /** All resolvables provided by this source. */
       const ResStore & resolvables(Source & source_r);
 
-      /** Provide a file to local filesystem */
+      /**
+       * Provide a file to local filesystem
+       *
+       * \throws Exception
+       *
+       */
       const Pathname provideFile(const Pathname & file,
                                 const unsigned media_nr = 1);
 
-      /** Provide a directory to local filesystem */
+      /**
+       * Provide a directory to local filesystem
+       *
+       * \throws Exception
+       *
+       */
       const Pathname provideDir(const Pathname & path,
                                const unsigned media_nr = 1,
                                const bool recursive = false);