1
0
mirror of https://github.com/fabianonline/telegram_backup.git synced 2024-11-22 08:46:15 +00:00

Kotlin: Fixed the bugs introduced by ResultSet#getString() being able to return NULL without Kotlin knowing about that.

This commit is contained in:
Fabian Schlenz 2017-12-12 06:09:55 +01:00
parent 9bc2ed7666
commit 7067f98943
2 changed files with 4 additions and 4 deletions

View File

@ -662,13 +662,13 @@ class Database private constructor(var client: TelegramClient) {
abstract val query: String
}
inner class Dialog(var id: Int, var first_name: String, var last_name: String, var username: String, var count: Int) : AbstractChat() {
inner class Dialog(var id: Int, var first_name: String?, var last_name: String?, var username: String?, var count: Int?) : AbstractChat() {
override val query: String
get() = "source_type='dialog' AND source_id=" + id
}
inner class Chat(var id: Int, var name: String, var count: Int) : AbstractChat() {
inner class Chat(var id: Int, var name: String?, var count: Int?) : AbstractChat() {
override val query: String
get() = "source_type IN('group', 'supergroup', 'channel') AND source_id=" + id

View File

@ -73,8 +73,8 @@ class HTMLExporter {
var count_messages_chats = 0
var count_messages_dialogs = 0
for (c in chats) count_messages_chats += c.count
for (d in dialogs) count_messages_dialogs += d.count
for (c in chats) count_messages_chats += c.count ?: 0
for (d in dialogs) count_messages_dialogs += d.count ?: 0
scope.put("count.messages", count_messages_chats + count_messages_dialogs)
scope.put("count.messages.chats", count_messages_chats)