Prevent crash from a ConversationTracker exception. Fixes BUKKIT-5436

This commit is contained in:
Devin Ryan 2014-04-13 16:12:17 -05:00 committed by md_5
parent 0410a40c1f
commit 5483861924

View file

@ -0,0 +1,40 @@
From bd5de624cf81503ac6f5309bdd61446e9a677518 Mon Sep 17 00:00:00 2001
From: Devin Ryan <devin@forairan.com>
Date: Mon, 14 Apr 2014 11:33:48 +1000
Subject: [PATCH] Prevent crash from a ConversationTracker exception.
Fixes BUKKIT-5436
diff --git a/src/main/java/org/bukkit/craftbukkit/conversations/ConversationTracker.java b/src/main/java/org/bukkit/craftbukkit/conversations/ConversationTracker.java
index 1d770a5..497d1d7 100644
--- a/src/main/java/org/bukkit/craftbukkit/conversations/ConversationTracker.java
+++ b/src/main/java/org/bukkit/craftbukkit/conversations/ConversationTracker.java
@@ -1,10 +1,12 @@
package org.bukkit.craftbukkit.conversations;
+import org.bukkit.Bukkit;
import org.bukkit.conversations.Conversation;
import org.bukkit.conversations.ConversationAbandonedEvent;
import org.bukkit.conversations.ManuallyAbandonedConversationCanceller;
import java.util.LinkedList;
+import java.util.logging.Level;
/**
*/
@@ -43,7 +45,11 @@ public class ConversationTracker {
LinkedList<Conversation> oldQueue = conversationQueue;
conversationQueue = new LinkedList<Conversation>();
for(Conversation conversation : oldQueue) {
- conversation.abandon(new ConversationAbandonedEvent(conversation, new ManuallyAbandonedConversationCanceller()));
+ try {
+ conversation.abandon(new ConversationAbandonedEvent(conversation, new ManuallyAbandonedConversationCanceller()));
+ } catch (Throwable t) {
+ Bukkit.getLogger().log(Level.SEVERE, "Unexpected exception while abandoning a conversation", t);
+ }
}
}
--
1.8.3.2