Code cleanup: avoid call to BLI_countlist
authorCampbell Barton <ideasman42@gmail.com>
Wed, 28 May 2014 16:22:04 +0000 (02:22 +1000)
committerCampbell Barton <ideasman42@gmail.com>
Fri, 13 Jun 2014 14:47:10 +0000 (00:47 +1000)
source/blender/blenkernel/intern/sequencer.c

index a1cd6b87a053baca8825917c29b50945c02a0f9b..4118be67a38befce83589918c259bf691d3e7602 100644 (file)
@@ -3075,13 +3075,12 @@ static ImBuf *seq_render_strip_stack(const SeqRenderData *context, ListBase *seq
 ImBuf *BKE_sequencer_give_ibuf(const SeqRenderData *context, float cfra, int chanshown)
 {
        Editing *ed = BKE_sequencer_editing_get(context->scene, false);
-       int count;
        ListBase *seqbasep;
        
        if (ed == NULL) return NULL;
 
-       count = BLI_countlist(&ed->metastack);
-       if ((chanshown < 0) && (count > 0)) {
+       if ((chanshown < 0) && !BLI_listbase_is_empty(&ed->metastack)) {
+               int count = BLI_countlist(&ed->metastack);
                count = max_ii(count + chanshown, 0);
                seqbasep = ((MetaStack *)BLI_findlink(&ed->metastack, count))->oldbasep;
        }