From 8ef0904d2684145c28fa2d85e250310d73c632e6 Mon Sep 17 00:00:00 2001 From: Danila Fedorin Date: Tue, 14 Nov 2017 23:08:04 -0800 Subject: [PATCH] Fix crash when a TreeValueFunction doesn't have documentation loaded. --- .../java/org/nwapw/abacus/fx/AbacusController.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/fx/src/main/java/org/nwapw/abacus/fx/AbacusController.java b/fx/src/main/java/org/nwapw/abacus/fx/AbacusController.java index 9a76903..903225a 100644 --- a/fx/src/main/java/org/nwapw/abacus/fx/AbacusController.java +++ b/fx/src/main/java/org/nwapw/abacus/fx/AbacusController.java @@ -359,10 +359,13 @@ public class AbacusController implements PluginListener { if(documentationInstance == null) documentationInstance = new Documentation(name, "", "", "", DocumentationType.FUNCTION); return documentationInstance; - }) - .collect(Collectors.toCollection(ArrayList::new))); - functionList.addAll(manager.getAllTreeValueFunctions().stream().map(name -> pluginManager.documentationFor(name, DocumentationType.TREE_VALUE_FUNCTION)) - .collect(Collectors.toCollection(ArrayList::new))); + }).collect(Collectors.toCollection(ArrayList::new))); + functionList.addAll(manager.getAllTreeValueFunctions().stream().map(name -> { + Documentation documentationInstance = pluginManager.documentationFor(name, DocumentationType.TREE_VALUE_FUNCTION); + if(documentationInstance == null) + documentationInstance = new Documentation(name, "", "", "", DocumentationType.TREE_VALUE_FUNCTION); + return documentationInstance; + }).collect(Collectors.toCollection(ArrayList::new))); functionList.sort(Comparator.comparing(Documentation::getCodeName)); }