changeset 7716:fa8a56a351a5

null-check on leafGraphArray
author Roland Schatz <roland.schatz@oracle.com>
date Tue, 05 Feb 2013 15:24:15 +0100
parents ab7a97237115
children cf94bd18eb47
files src/share/vm/graal/graalCodeInstaller.cpp
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/graal/graalCodeInstaller.cpp	Tue Feb 05 13:54:18 2013 +0100
+++ b/src/share/vm/graal/graalCodeInstaller.cpp	Tue Feb 05 15:24:15 2013 +0100
@@ -291,8 +291,15 @@
 GrowableArray<jlong>* get_leaf_graph_ids(Handle& comp_result) {
   arrayOop leafGraphArray = (arrayOop) CompilationResult::leafGraphIds(HotSpotCompilationResult::comp(comp_result));
 
-  GrowableArray<jlong>* result = new GrowableArray<jlong>(leafGraphArray->length());
-  for (int i = 0; i < leafGraphArray->length(); i++) {
+  jint length;
+  if (leafGraphArray == NULL) {
+    length = 0;
+  } else {
+    length = leafGraphArray->length();
+  }
+
+  GrowableArray<jlong>* result = new GrowableArray<jlong>(length);
+  for (int i = 0; i < length; i++) {
     result->append(((jlong*) leafGraphArray->base(T_LONG))[i]);
   }