if (!element) {
if (!element || !jname) {
JNIEXPORT jobject JNICALL Java_org_mozilla_dom_ElementImpl_getElementsByTagName  (JNIEnv *env, jobject jthis, jstring jname){  nsIDOMElement* element = (nsIDOMElement*)     env->GetLongField(jthis, JavaDOMGlobals::nodePtrFID);  if (!element) {    JavaDOMGlobals::ThrowException(env,      "Element.getElementsByTagName: NULL pointer");    return NULL;  }  const char* cname = NULL;  jboolean iscopy = JNI_FALSE;  if (jname) {    cname = env->GetStringUTFChars(jname, &iscopy);    if (!cname) {      JavaDOMGlobals::ThrowException(env,        "Element.getElementsByTagName: GetStringUTFChars failed");      return NULL;    }  }  nsIDOMNodeList* nodes = nsnull;  nsresult rv = element->GetElementsByTagName(cname, &nodes);  if (iscopy == JNI_TRUE)    env->ReleaseStringUTFChars(jname, cname);  if (NS_FAILED(rv) || !nodes) {    JavaDOMGlobals::ThrowException(env,      "Element.getElementsByTagName: failed", rv);    return NULL;  }  jobject jnodes = env->AllocObject(JavaDOMGlobals::nodeListClass);  if (!jnodes) {    JavaDOMGlobals::ThrowException(env,      "Element.getElementsByTagName: failed to allocate object");    return NULL;  }  env->SetLongField(jnodes, JavaDOMGlobals::nodeListPtrFID, (jlong) nodes);  if (env->ExceptionOccurred()) {    JavaDOMGlobals::ThrowException(env,      "Element.getElementsByTagName: failed to set node ptr");    return NULL;  }  nodes->AddRef();  return jnodes;}