Skip to content

Commit d819420

Browse files
committed
NPE bug fix
1 parent a8bf75a commit d819420

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/main/kotlin/org/kraftwerk28/spigot_tg_bridge/TgBot.kt

+5-4
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,9 @@ class TgBot(
103103
update.message?.text?.let {
104104
commandRegex.matchEntire(it)?.groupValues?.let {
105105
commandMap[it[1]]?.let { it(update) }
106+
} ?: run {
107+
onTextHandler(update)
106108
}
107-
} ?: run {
108-
onTextHandler(update)
109109
}
110110
}
111111

@@ -185,9 +185,10 @@ class TgBot(
185185
}
186186

187187
private suspend fun onTextHandler(update: TgApiService.Update) {
188-
if (!config.logFromTGtoMC) return
189188
val msg = update.message!!
190-
plugin.sendMessageToMinecraft(msg.text!!, msg.from!!.rawUserMention())
189+
if (!config.logFromTGtoMC || msg.from == null)
190+
return
191+
plugin.sendMessageToMinecraft(msg.text!!, msg.from.rawUserMention())
191192
}
192193

193194
private fun formatMsgFromMinecraft(

src/main/resources/plugin.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: SpigotTGBridge
2-
version: "0.16"
2+
version: "0.17"
33
api-version: "1.15"
44
main: org.kraftwerk28.spigot_tg_bridge.Plugin
55
description: Telegram <-> Minecraft communication plugin for Spigot.

0 commit comments

Comments
 (0)