Fix potential null pointer dereference in src/classdef.cpp