We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ba78658 commit 6fb02d8Copy full SHA for 6fb02d8
1 file changed
src/main/java/org/perlonjava/runtime/RuntimeHash.java
@@ -70,6 +70,11 @@ public int countElements() {
70
* @param array The RuntimeArray to which this hash will be added.
71
*/
72
public void addToArray(RuntimeArray array) {
73
+
74
+ if (this.elements instanceof AutovivificationHash) {
75
+ throw new PerlCompilerException("Can't use an undefined value as an HASH reference");
76
+ }
77
78
List<RuntimeScalar> elements = array.elements;
79
for (Map.Entry<String, RuntimeScalar> entry : this.elements.entrySet()) {
80
elements.add(new RuntimeScalar(entry.getKey()));
0 commit comments