From 7c3e92e391e5e4006e9fad141b522a9cbec1c233 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Tue, 31 May 2022 14:36:14 -0700 Subject: [PATCH] move pointer test to generic helper This should always be tested for - the only other user of the generic helper currently didn't test for it, either. Signed-off-by: Dirk Hohndel --- src/field-cache.c | 3 +++ src/garmin_parser.c | 3 --- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/field-cache.c b/src/field-cache.c index ddb706a..d201b8b 100644 --- a/src/field-cache.c +++ b/src/field-cache.c @@ -71,6 +71,9 @@ dc_status_t dc_field_get_string(dc_field_cache_t *cache, unsigned idx, dc_field_ dc_status_t dc_field_get(dc_field_cache_t *cache, dc_field_type_t type, unsigned int flags, void* value) { + if (!value) + return DC_STATUS_INVALIDARGS; + if (!(cache->initialized & (1 << type))) return DC_STATUS_UNSUPPORTED; diff --git a/src/garmin_parser.c b/src/garmin_parser.c index 99f3b85..5f882e1 100644 --- a/src/garmin_parser.c +++ b/src/garmin_parser.c @@ -1489,9 +1489,6 @@ garmin_parser_get_field (dc_parser_t *abstract, dc_field_type_t type, unsigned i { garmin_parser_t *garmin = (garmin_parser_t *) abstract; - if (!value) - return DC_STATUS_INVALIDARGS; - return dc_field_get(&garmin->cache, type, flags, value); }