Skip to content

Commit

Permalink
better error message for command blocks without body
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed May 5, 2020
1 parent a996e1a commit fbc8e22
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ public static String stripLinePrefix(String rawLine) {
}

public static List<ScriptEntry> buildScriptEntries(List<Object> contents, ScriptContainer parent, ScriptEntryData data) {
List<ScriptEntry> scriptCommands = new ArrayList<>(contents.size());

if (contents == null || contents.isEmpty()) {
if (Debug.showScriptBuilder) {
Expand All @@ -35,6 +34,7 @@ public static List<ScriptEntry> buildScriptEntries(List<Object> contents, Script
Debug.echoDebug(parent, "Building script entries:");
}

List<ScriptEntry> scriptCommands = new ArrayList<>(contents.size());
for (Object ientry : contents) {

if (ientry == null) {
Expand All @@ -47,7 +47,12 @@ public static List<ScriptEntry> buildScriptEntries(List<Object> contents, Script
if (ientry instanceof Map) {
Object key = ((Map) ientry).keySet().toArray()[0];
entry = key.toString();
inside = (List<Object>) ((Map) ientry).get(key);
Object rawValue = ((Map) ientry).get(key);
if (!(rawValue instanceof List)) {
Debug.echoError("Script '" + parent.getName() + "' has invalid line " + ientry + ": line ends with ':' but no script body inside.");
return null;
}
inside = (List<Object>) rawValue;
}
else {
entry = ientry.toString();
Expand Down

0 comments on commit fbc8e22

Please sign in to comment.