[addoncallbacks] check key is non-null before use

Previously these would have been safe due to StdString ignoring NULL's.  Better to be safe than crash.