[Aptitude-svn-commit] r3393 - in branches/aptitude-0.3/aptitude: . src src/cmdline
Daniel Burrows
dburrows@costa.debian.org
Wed, 08 Jun 2005 22:33:58 +0000
Author: dburrows
Date: Wed Jun 8 22:33:56 2005
New Revision: 3393
Modified:
branches/aptitude-0.3/aptitude/ChangeLog
branches/aptitude-0.3/aptitude/src/cmdline/cmdline_show.cc
branches/aptitude-0.3/aptitude/src/solution_fragment.cc
Log:
Fix the crash due to forgetting that archive pointers can be NULL.
Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog (original)
+++ branches/aptitude-0.3/aptitude/ChangeLog Wed Jun 8 22:33:56 2005
@@ -1,3 +1,11 @@
+2005-06-08 Daniel Burrows <dburrows@debian.org>
+
+ * src/cmdline/cmdline_show.cc, src/solution_fragment.cc:
+
+ Fix several places where aptitude could crash because I forgot
+ that PkgFileIterator::Archive can return a NULL pointer.
+ (Closes: #312553)
+
2005-06-08 Christian Perrier <bubulle@debian.org>
* po/fi.po: Overtranslation corrected. Closes: #312311
Modified: branches/aptitude-0.3/aptitude/src/cmdline/cmdline_show.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/cmdline/cmdline_show.cc (original)
+++ branches/aptitude-0.3/aptitude/src/cmdline/cmdline_show.cc Wed Jun 8 22:33:56 2005
@@ -114,7 +114,12 @@
vector<fragment *> fragments;
for( ; !vf.end(); ++vf)
- fragments.push_back(text_fragment(vf.File().Archive()));
+ {
+ if(vf.File().Archive() == 0)
+ fragments.push_back(text_fragment(_("<NULL>")));
+ else
+ fragments.push_back(text_fragment(vf.File().Archive()));
+ }
if(fragments.size()==0)
return fragf("");
@@ -296,7 +301,9 @@
if(verbose<2) // Show all archives in a list.
fragments.push_back(archive_lst_frag(ver.FileList(), _("Archive")));
else
- fragments.push_back(fragf("%s: %s%n", _("Archive"), vf.File().Archive()));
+ {
+ fragments.push_back(fragf("%s: %s%n", _("Archive"), vf.File().Archive()?vf.File().Archive():_("<NULL>")));
+ }
}
fragments.push_back(dep_lst_frag(ver.DependsList(),
Modified: branches/aptitude-0.3/aptitude/src/solution_fragment.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/solution_fragment.cc (original)
+++ branches/aptitude-0.3/aptitude/src/solution_fragment.cc Wed Jun 8 22:33:56 2005
@@ -58,7 +58,12 @@
vector<fragment *> archive_fragments;
for(pkgCache::VerFileIterator vf=v.FileList(); !vf.end(); ++vf)
- archive_fragments.push_back(text_fragment(vf.File().Archive()));
+ {
+ if(vf.File().Archive())
+ archive_fragments.push_back(text_fragment(vf.File().Archive()));
+ else
+ archive_fragments.push_back(text_fragment(_("<NULL>")));
+ }
return join_fragments(archive_fragments, ",");
}