diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RSerialize.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RSerialize.java index 9d6cfd297e91be1e4e850222d83da429b89d6e80..00ed14aecea4faa1e75f344e508768d4e918f48c 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RSerialize.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RSerialize.java @@ -2744,18 +2744,20 @@ public class RSerialize { assert srcfile instanceof REnvironment; Source source = RSource.fromSrcfile((REnvironment) srcfile); - RList l = (RList) srcref; + RList blockSrcref = (RList) srcref; RSyntaxElement[] syntaxArguments = elem.getSyntaxArguments(); - assert syntaxArguments.length == l.getLength() - 1; - - for (int i = 0; i < l.getLength(); i++) { - Object dataAt = l.getDataAt(i); - assert dataAt instanceof RAbstractIntVector; - SourceSection ss = RSrcref.createSourceSection((RAbstractIntVector) dataAt, source); - if (i == 0) { - elem.setSourceSection(ss); - } else { - syntaxArguments[i - 1].setSourceSection(ss); + assert syntaxArguments.length == blockSrcref.getLength() - 1; + + for (int i = 0; i < blockSrcref.getLength(); i++) { + Object singleSrcref = blockSrcref.getDataAt(i); + // could also be NULL + if (singleSrcref instanceof RAbstractIntVector) { + SourceSection ss = RSrcref.createSourceSection((RAbstractIntVector) singleSrcref, source); + if (i == 0) { + elem.setSourceSection(ss); + } else { + syntaxArguments[i - 1].setSourceSection(ss); + } } } } catch (NoSuchFileException e) {