Fixed a potential null dereference in ncgen.
corrected an undefined value error identified by clang.