papermc/CraftBukkit-Patches/0136-Prevent-crash-from-a-ConversationTracker-exception.patch
2014-04-14 14:35:29 +10:00

40 lines
1.6 KiB
Diff

From c4611db9d7d06723ded37a11c24a808e04c1ef6f 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