prevent from return if ref_idx is error

review request see:
https://rbcommons.com/s/OpenH264/r/368/