NDPI: prevent potential NPE when checking the type

Fixes NPEs noticed by @rleigh-dundee when testing .lsm files (see #461).  Not to be rebased onto dev_4_4.