Fixed NULL defrenced pointer reported by scan-build