avoid null pointer deref in Java_java_io_RandomAccessFile_open

This commit is contained in:
Joel Dice 2008-10-06 17:30:07 -06:00
parent ae75be5683
commit 114bf777bb

View File

@ -459,7 +459,7 @@ Java_java_io_RandomAccessFile_open(JNIEnv* e, jclass, jstring path,
jlong peer = reinterpret_cast<jlong>(mapping);
e->SetLongArrayRegion(result, 0, 1, &peer);
jlong length = mapping->length;
jlong length = (mapping ? mapping->length : 0);
e->SetLongArrayRegion(result, 1, 1, &length);
e->ReleaseStringUTFChars(path, chars);