Fix infinite loop in decodeTypeAndVal().