From 4cb1996e3c5f739c78697c1c166c8f7efc5af2fe Mon Sep 17 00:00:00 2001 From: jstebbins Date: Sun, 9 Dec 2012 19:08:08 +0000 Subject: libhb: fix hb_dict_next() when dict is empty It would return an invalid entry instead of NULL. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5095 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- libhb/hb_dict.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'libhb/hb_dict.c') diff --git a/libhb/hb_dict.c b/libhb/hb_dict.c index 6c4ac8699..152cf7feb 100644 --- a/libhb/hb_dict.c +++ b/libhb/hb_dict.c @@ -145,9 +145,9 @@ hb_dict_entry_t * hb_dict_get( hb_dict_t * dict, const char * key ) hb_dict_entry_t * hb_dict_next( hb_dict_t * dict, hb_dict_entry_t * previous ) { - if( !dict || !dict->objects ) + if( dict == NULL || dict->objects == NULL || !dict->count ) return NULL; - if( !previous ) + if( previous == NULL ) return &dict->objects[0]; unsigned int prev_index = previous - dict->objects; if( prev_index + 1 < dict->count ) -- cgit v1.2.3