Fix null pointer dereference accessing reference pics in h264_decode() function

It fixes crashes when changing aspect ratio of h264 files in mplayer.

How to reproduce it

```
Open an h264 video file using mplayer slave mode:
mplayer -osdlevel 0 -msglevel all=-1:global=4:identify=5 -fs -slave -input nodefault-bindings -noconfig all -vo vdpau -vc ffmpeg12vdpau,ffh264vdpau,ffodivxvdpau,-ffwmv3vdpau,-ffvc1vdpau, /tmp/usb/medios/ElephantsDream-DivXPlusHD.mkv

Change the aspect ratio:
switch_ratio 1.333333
```

With this change, i see artifacts in the video for a couple of seconds because of the lost of reference frames. I don't know if there is a better fix, i don't know all the code yet. If you have any hint i can try a better fix but i think this is better than a crash.