fix bug: segmentfault when decode error