From 4b71596c425021983c33898c9c65903253250d9e Mon Sep 17 00:00:00 2001 From: Master Kwoth Date: Thu, 28 Jan 2016 13:37:18 +0100 Subject: [PATCH] no longer required to add article to prevent crash --- NadekoBot/Commands/SpeedTyping.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/NadekoBot/Commands/SpeedTyping.cs b/NadekoBot/Commands/SpeedTyping.cs index 498f82be..8e793b40 100644 --- a/NadekoBot/Commands/SpeedTyping.cs +++ b/NadekoBot/Commands/SpeedTyping.cs @@ -15,7 +15,11 @@ namespace NadekoBot { public static class SentencesProvider { internal static string GetRandomSentence() { var data = new ParseQuery("TypingArticles").FindAsync().Result; - return data.ToList()[(new Random()).Next(0, data.Count())].Get("text"); + try { + return data.ToList()[(new Random()).Next(0, data.Count())].Get("text"); + } catch (Exception) { + return "Failed retrieving data from parse. Owner didn't add any articles to type using `typeadd`."; + } } }