From 92dfebcd0bbdeb3dcf0ee0f3f204ab574af8f97a Mon Sep 17 00:00:00 2001 From: bivashy Date: Thu, 27 Jul 2023 01:51:38 +0600 Subject: [PATCH] printStackTrace on exception in DiscordKeyboards#createKeyboardModel --- .../auth/config/discord/DiscordKeyboards.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/core/src/main/java/me/mastercapexd/auth/config/discord/DiscordKeyboards.java b/core/src/main/java/me/mastercapexd/auth/config/discord/DiscordKeyboards.java index c26c8b9a..9ffa0f4b 100644 --- a/core/src/main/java/me/mastercapexd/auth/config/discord/DiscordKeyboards.java +++ b/core/src/main/java/me/mastercapexd/auth/config/discord/DiscordKeyboards.java @@ -31,11 +31,16 @@ public Map getRawJsonKeyboards() { @Override public Keyboard createKeyboardModel(String rawJson) { - DataObject dataObject = DataObject.fromJson(rawJson); - DataArray rowsDataArray = dataObject.getArray("rows"); - List actionRows = new ArrayList<>(); - for (int i = 0; i < rowsDataArray.length(); i++) - actionRows.add(ActionRow.fromData(rowsDataArray.getObject(i))); - return new DiscordKeyboard(actionRows); + try { + DataObject dataObject = DataObject.fromJson(rawJson); + DataArray rowsDataArray = dataObject.getArray("rows"); + List actionRows = new ArrayList<>(); + for (int i = 0; i < rowsDataArray.length(); i++) + actionRows.add(ActionRow.fromData(rowsDataArray.getObject(i))); + return new DiscordKeyboard(actionRows); + } catch(Throwable t) { + t.printStackTrace(); + return new DiscordKeyboard(); + } } }