Skip to content

Commit 1ac6779

Browse files
committed
display empty R vector as '[]'
1 parent 2a812f3 commit 1ac6779

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

visualvm/heapviewer.truffle/src/org/graalvm/visualvm/heapviewer/truffle/lang/r/RDetailsProvider.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,12 @@ public String getDetailsString(String className, Instance instance, Heap heap) {
165165
Integer len = (Integer) instance.getValueOfField("length"); // NOI18N
166166

167167
if (stride != null && start != null & len != null) {
168+
int length = len.intValue();
169+
if (length == 0) { // empty vector
170+
return "[]";
171+
}
168172
if (stride.intValue() == 1) {
169-
int end = start.intValue() + len.intValue()-1;
173+
int end = start.intValue() + length-1;
170174
return "["+start.intValue()+":"+end+"]";
171175
}
172176
}

0 commit comments

Comments
 (0)