From 72272f430d6aa45a3c48b7b339dbd14f1a70d5c7 Mon Sep 17 00:00:00 2001 From: christ66 Date: Sun, 7 Sep 2014 18:46:43 -0700 Subject: [PATCH] Fixed NPE when onEnterBlocked() is called during startup. --- .../sorter/AdvancedQueueSorterQueueListener.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/jenkins/advancedqueue/sorter/AdvancedQueueSorterQueueListener.java b/src/main/java/jenkins/advancedqueue/sorter/AdvancedQueueSorterQueueListener.java index 9dae349b..93ee3d02 100644 --- a/src/main/java/jenkins/advancedqueue/sorter/AdvancedQueueSorterQueueListener.java +++ b/src/main/java/jenkins/advancedqueue/sorter/AdvancedQueueSorterQueueListener.java @@ -58,7 +58,11 @@ public void onEnterBuildable(BuildableItem bi) { @Override public void onEnterBlocked(BlockedItem bi) { - QueueItemCache.get().getItem(bi.id).setBlocked(); + ItemInfo item = QueueItemCache.get().getItem(bi.id); + // Null at startup + if (item != null) { + item.setBlocked(); + } } }