summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libavcodec/agm.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libavcodec/agm.c b/libavcodec/agm.c
index f5fd5d065e..f3d81bf163 100644
--- a/libavcodec/agm.c
+++ b/libavcodec/agm.c
@@ -913,7 +913,7 @@ static void get_tree_codes(uint32_t *codes, Node *nodes, int idx, uint32_t pfx,
{
if (idx < 256 && idx >= 0) {
codes[idx] = pfx;
- } else {
+ } else if (idx >= 0) {
get_tree_codes(codes, nodes, nodes[idx].child[0], pfx + (0 << bitpos), bitpos + 1);
get_tree_codes(codes, nodes, nodes[idx].child[1], pfx + (1 << bitpos), bitpos + 1);
}