Why am I encountering a null variable here?

this is pretty weird,

Dnn.readNet() (or it’s fromXXX siblings) should throw an exception on failure, halting your program, did you miss (or disable) that ?

(e.g. Net net = Dnn.readNetFromCaffe("nada","/nada"); should result in an exception like: error: (-2:Unspecified error) FAILED: fs.is_open(). Can't open "nada" in function 'ReadProtoFromTextFile')
please edit your post, and show some lines of code around that, so we can take a better look at your problem