Null check on error callback
added SGL.cpp the definition init function to avoid possible linker errors