cppcheck is right that the check for preventing null deference of Query
authorDavid Kalnischkies <kalnischkies@gmail.com>
Thu, 11 Aug 2011 16:42:19 +0000 (18:42 +0200)
committerDavid Kalnischkies <kalnischkies@gmail.com>
Thu, 11 Aug 2011 16:42:19 +0000 (18:42 +0200)
is redundant in Redirect() as we can't reach the code with null anyway

[apt-pkg/acquire-method.cc:433]: (error) Possible null pointer dereference:
 Queue - otherwise it is redundant to check if Queue is null at line 425

apt-pkg/acquire-method.cc

index e9e1024..79a7519 100644 (file)
@@ -421,12 +421,8 @@ void pkgAcqMethod::Status(const char *Format,...)
    to keep the pipeline synchronized. */
 void pkgAcqMethod::Redirect(const string &NewURI)
 {
-   std::cout << "103 Redirect\nURI: ";
-   if (Queue != 0)
-      std::cout << Queue->Uri << "\n";
-   else
-      std::cout << "<UNKNOWN>\n";
-   std::cout << "New-URI: " << NewURI << "\n"
+   std::cout << "103 Redirect\nURI: " << Queue->Uri << "\n"
+            << "New-URI: " << NewURI << "\n"
             << "\n" << std::flush;
 
    // Change the URI for the request.