[Aptitude-svn-commit] r4084 - in branches/aptitude-0.3/aptitude: . src

Daniel Burrows dburrows at costa.debian.org
Wed Sep 14 20:24:12 UTC 2005


Author: dburrows
Date: Wed Sep 14 20:24:09 2005
New Revision: 4084

Modified:
   branches/aptitude-0.3/aptitude/ChangeLog
   branches/aptitude-0.3/aptitude/src/ui.cc
Log:
Don't segfault trying to access a NULL resolver manager.

Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog	(original)
+++ branches/aptitude-0.3/aptitude/ChangeLog	Wed Sep 14 20:24:09 2005
@@ -1,5 +1,11 @@
 2005-09-14  Daniel Burrows  <dburrows at debian.org>
 
+	* src/ui.cc:
+
+	  When accessing resman in contexts where the apt cache might not
+	  be loaded (hence the globals don't exist), check whether it's
+	  NULL before accessing it.
+
 	* src/generic/resolver_manager.cc:
 
 	  In maybe_create_resolver, don't try to create a resolver unless

Modified: branches/aptitude-0.3/aptitude/src/ui.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/ui.cc	(original)
+++ branches/aptitude-0.3/aptitude/src/ui.cc	Wed Sep 14 20:24:09 2005
@@ -1048,6 +1048,7 @@
 
   try
     {
+      assert(resman != NULL);
       assert(resman->resolver_exists());
 
       aptitude_solution sol = resman->get_current_solution();
@@ -1508,7 +1509,7 @@
 
 static void handle_dump_resolver_response(const wstring &s)
 {
-  if(resman->resolver_exists())
+  if(resman != NULL && resman->resolver_exists())
     {
       ofstream out(transcode(s).c_str());
 
@@ -1528,7 +1529,7 @@
 {
   static vs_editline::history_list history;
 
-  if(resman->resolver_exists())
+  if(resman != NULL && resman->resolver_exists())
     prompt_string(_("File to which the resolver state should be dumped:"),
 		  "",
 		  arg(sigc::ptr_fun(handle_dump_resolver_response)),
@@ -2005,7 +2006,7 @@
   //
   // Note that it *should* be visible if we enter this code from the
   // command-line (i.e., with the cache already loaded).  More hack?
-  if(resman->resolver_exists())
+  if(resman != NULL && resman->resolver_exists())
     b->show();
   else
     b->hide();



More information about the Aptitude-svn-commit mailing list