From db27b9d050c466eabf6eb72899bfbe696af8852b Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Fri, 24 Jul 2009 20:49:39 +0200 Subject: python: Fix some more possible NULL issues. --- python/cache.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'python/cache.cc') diff --git a/python/cache.cc b/python/cache.cc index 30c0e683..68ee7b9e 100644 --- a/python/cache.cc +++ b/python/cache.cc @@ -840,6 +840,7 @@ static PyObject *VersionGetIsTrusted(PyObject *Self, void*) { } #endif +#define NOTNULL(x) (x ? x : "") static PyObject *VersionRepr(PyObject *Self) { @@ -848,11 +849,12 @@ static PyObject *VersionRepr(PyObject *Self) " Arch:'%s' Size:%lu ISize:%lu Hash:%u ID:%u " "Priority:%u>", Self->ob_type->tp_name, Ver.ParentPkg().Name(), Ver.VerStr(), - Ver.Section(), Ver.Arch(), + NOTNULL(Ver.Section()), NOTNULL(Ver.Arch()), (unsigned long)Ver->Size, (unsigned long)Ver->InstalledSize, Ver->Hash, Ver->ID, Ver->Priority); } +#undef NOTNULL static PyGetSetDef VersionGetSet[] = { {"arch",VersionGetArch}, @@ -1096,7 +1098,7 @@ static PyObject *DependencyRepr(PyObject *Self) return PyString_FromFormat("<%s object: pkg:'%s' ver:'%s' comp:'%s'>", Self->ob_type->tp_name, Dep.TargetPkg().Name(), - (Dep.TargetVer() == 0?"":Dep.TargetVer()), + (Dep.TargetVer() == 0 ? "" : Dep.TargetVer()), Dep.CompType()); } -- cgit v1.2.3