diff options
author | jstebbins <[email protected]> | 2012-12-09 19:08:08 +0000 |
---|---|---|
committer | jstebbins <[email protected]> | 2012-12-09 19:08:08 +0000 |
commit | 4cb1996e3c5f739c78697c1c166c8f7efc5af2fe (patch) | |
tree | d9247b6b6367b944f30b61fdc7788a826244118a /libhb/hb_dict.c | |
parent | e8fe42b7aa00a6a8929da0275a75f069729e632d (diff) |
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
Diffstat (limited to 'libhb/hb_dict.c')
-rw-r--r-- | libhb/hb_dict.c | 4 |
1 files changed, 2 insertions, 2 deletions
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 ) |