diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2012-10-05 10:09:50 +0300 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2012-10-05 10:09:50 +0300 |
commit | db80e6ed5aea6c688104125059b3f11cc763f682 (patch) | |
tree | 4fdde059a480e194a521bcb1492d68fe4963b78a | |
parent | f4758b19201d6780d9bb84e50ee004090ec4b1bf (diff) | |
download | librpm-tizen-db80e6ed5aea6c688104125059b3f11cc763f682.tar.gz librpm-tizen-db80e6ed5aea6c688104125059b3f11cc763f682.tar.bz2 librpm-tizen-db80e6ed5aea6c688104125059b3f11cc763f682.zip |
Guard against NULL ds in the rpmds indexed getters
- NULL dependency sets are all over the place as NULL ds means
"no dependencies of this kind", whereas for eg rpmfi NULL is an
error.
-rw-r--r-- | lib/rpmds.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/rpmds.c b/lib/rpmds.c index 648203736..04dc75816 100644 --- a/lib/rpmds.c +++ b/lib/rpmds.c @@ -82,7 +82,7 @@ static int dsType(rpmTagVal tag, rpmsid rpmdsNIdIndex(rpmds ds, int i) { rpmsid id = 0; - if (i >= 0 && i < ds->Count && ds->N != NULL) + if (ds != NULL && i >= 0 && i < ds->Count && ds->N != NULL) id = ds->N[i]; return id; } @@ -90,14 +90,14 @@ rpmsid rpmdsNIdIndex(rpmds ds, int i) rpmsid rpmdsEVRIdIndex(rpmds ds, int i) { rpmsid id = 0; - if (i >= 0 && i < ds->Count && ds->EVR != NULL) + if (ds != NULL && i >= 0 && i < ds->Count && ds->EVR != NULL) id = ds->EVR[i]; return id; } const char * rpmdsNIndex(rpmds ds, int i) { const char * N = NULL; - if (i >= 0 && i < ds->Count && ds->N != NULL) + if (ds != NULL && i >= 0 && i < ds->Count && ds->N != NULL) N = rpmstrPoolStr(ds->pool, ds->N[i]); return N; } @@ -105,7 +105,7 @@ const char * rpmdsNIndex(rpmds ds, int i) const char * rpmdsEVRIndex(rpmds ds, int i) { const char * EVR = NULL; - if (i >= 0 && i < ds->Count && ds->EVR != NULL) + if (ds != NULL && i >= 0 && i < ds->Count && ds->EVR != NULL) EVR = rpmstrPoolStr(ds->pool, ds->EVR[i]); return EVR; } @@ -113,7 +113,7 @@ const char * rpmdsEVRIndex(rpmds ds, int i) rpmsenseFlags rpmdsFlagsIndex(rpmds ds, int i) { rpmsenseFlags Flags = 0; - if (i >= 0 && i < ds->Count && ds->Flags != NULL) + if (ds != NULL && i >= 0 && i < ds->Count && ds->Flags != NULL) Flags = ds->Flags[i]; return Flags; } @@ -121,7 +121,7 @@ rpmsenseFlags rpmdsFlagsIndex(rpmds ds, int i) rpm_color_t rpmdsColorIndex(rpmds ds, int i) { rpm_color_t Color = 0; - if (i >= 0 && i < ds->Count && ds->Color != NULL) + if (ds != NULL && i >= 0 && i < ds->Count && ds->Color != NULL) Color = ds->Color[i]; return Color; } |