if (!node) {
if (!node || !jchild) {
JNIEXPORT jobject JNICALL Java_org_mozilla_dom_NodeImpl_appendChild  (JNIEnv *env, jobject jthis, jobject jchild){  nsIDOMNode* node = (nsIDOMNode*)     env->GetLongField(jthis, JavaDOMGlobals::nodePtrFID);  if (!node) {    JavaDOMGlobals::ThrowException(env,      "Node.appendChild: NULL pointer");    return NULL;  }  nsIDOMNode* child = NULL;  if (jchild) {    child = (nsIDOMNode*)       env->GetLongField(jchild, JavaDOMGlobals::nodePtrFID);    if (!child) {      JavaDOMGlobals::ThrowException(env,        "Node.appendChild: NULL child pointer");      return NULL;    }  }  nsIDOMNode* ret = nsnull;  nsresult rv = node->AppendChild(child, &ret);  if (NS_FAILED(rv) || !ret) {    JavaDOMGlobals::ExceptionType exceptionType = JavaDOMGlobals::EXCEPTION_RUNTIME;    if (NS_ERROR_GET_MODULE(rv) == NS_ERROR_MODULE_DOM &&        (rv == NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR ||         rv == NS_ERROR_DOM_WRONG_DOCUMENT_ERR ||         rv == NS_ERROR_DOM_HIERARCHY_REQUEST_ERR)) {      exceptionType = JavaDOMGlobals::EXCEPTION_DOM;    }    JavaDOMGlobals::ThrowException(env,      "Node.appendChild: failed", rv, exceptionType);    return NULL;  }  return JavaDOMGlobals::CreateNodeSubtype(env, ret);}