File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -429,7 +429,7 @@ function MessageClassifierBrowser:updateMsgView()
429429
430430 self .msgView :Clear ()
431431 self .msgView .msgSize = # allMessages
432- self .msgView :SetMaxLines (self .msgView .msgSize )
432+ self .msgView :SetMaxLinesSafe (self .msgView .msgSize )
433433 for i = 1 , self .msgView .msgSize do
434434 local msg = allMessages [i ].msg
435435 local content = formatMsg (msg )
@@ -554,8 +554,16 @@ function MessageClassifierBrowser:CreateView()
554554 self .msgScroll :SetPoint (" TOPLEFT" , 0 , 0 )
555555 self .msgScroll :SetPoint (" BOTTOMRIGHT" , - 20 , 0 )
556556
557+ -- fix "Division by zero" error of SetMaxLines()
558+ function self .msgView :SetMaxLinesSafe (lines )
559+ if not lines or lines < 1 then
560+ lines = 1
561+ end
562+ return self :SetMaxLines (lines )
563+ end
564+
557565 self .msgView .msgSize = 0
558- self .msgView :SetMaxLines (self .msgView .msgSize )
566+ self .msgView :SetMaxLinesSafe (self .msgView .msgSize )
559567
560568 self .msgScroll .msgView = self .msgView
561569 self .msgView .msgScroll = self .msgScroll
You can’t perform that action at this time.
0 commit comments