Fix NPE in gif sample.