summaryrefslogtreecommitdiff
path: root/vp9/common/vp9_onyxc_int.h
diff options
context:
space:
mode:
Diffstat (limited to 'vp9/common/vp9_onyxc_int.h')
-rw-r--r--vp9/common/vp9_onyxc_int.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/vp9/common/vp9_onyxc_int.h b/vp9/common/vp9_onyxc_int.h
index 751accf02..6d14128a8 100644
--- a/vp9/common/vp9_onyxc_int.h
+++ b/vp9/common/vp9_onyxc_int.h
@@ -238,8 +238,10 @@ static int get_free_fb(VP9_COMMON *cm) {
}
static void ref_cnt_fb(int *buf, int *idx, int new_idx) {
- if (buf[*idx] > 0)
- buf[*idx]--;
+ const int ref_index = *idx;
+
+ if (ref_index > 0 && buf[ref_index] > 0)
+ buf[ref_index]--;
*idx = new_idx;