fix a possible crash detected by coverity