From 9ce35aad5410b0b9cf740079b0a8cd8d2bdbb112 Mon Sep 17 00:00:00 2001 From: Danila Fedorin Date: Wed, 26 Jul 2017 13:25:12 -0700 Subject: [PATCH] Correctly handle invalid strings. --- src/org/nwapw/abacus/tree/TreeNode.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/org/nwapw/abacus/tree/TreeNode.java b/src/org/nwapw/abacus/tree/TreeNode.java index 45f7741..8540677 100644 --- a/src/org/nwapw/abacus/tree/TreeNode.java +++ b/src/org/nwapw/abacus/tree/TreeNode.java @@ -129,7 +129,9 @@ public abstract class TreeNode { * @return the resulting tree. */ public static TreeNode fromString(String string){ - ArrayList> matches = intoPostfix(string, tokenize(string)); + ArrayList> matches = tokenize(string); + if(matches == null) return null; + matches = intoPostfix(string, matches); if(matches == null) return null; Collections.reverse(matches);