Corrected an issue causing an AttributeError exception.

Wed, 02 Oct 2024 09:10:04 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Wed, 02 Oct 2024 09:10:04 +0200
changeset 57
3a3726c1f684
parent 56
ef2d5f24ad32
child 58
7878fc1493fb

Corrected an issue causing an AttributeError exception.

OllamaInterface/OllamaChatWidget.py file | annotate | diff | comparison | revisions
--- a/OllamaInterface/OllamaChatWidget.py	Sun Sep 29 11:40:07 2024 +0200
+++ b/OllamaInterface/OllamaChatWidget.py	Wed Oct 02 09:10:04 2024 +0200
@@ -85,10 +85,11 @@
         @param message message text to be appended
         @type str
         """
-        msgBox = self.__messagesLayout.itemAt(
-            self.__messagesLayout.count() - 1
-        ).widget()
-        msgBox.appendMessage(message)
+        if self.__messagesLayout.count():
+            msgBox = self.__messagesLayout.itemAt(
+                self.__messagesLayout.count() - 1
+            ).widget()
+            msgBox.appendMessage(message)
 
         QTimer.singleShot(0, self.__scrollChatToBottom)
 

eric ide

mercurial