mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
fix: prevent endless loop with buttons
This commit is contained in:
parent
44bd8fe103
commit
c3071ac8f8
1 changed files with 6 additions and 3 deletions
|
|
@ -179,9 +179,12 @@ class KeyboardBuilder(Generic[ButtonType], ABC):
|
|||
last_row.extend(head)
|
||||
|
||||
# Separate buttons to exclusive rows with max possible row width
|
||||
while buttons:
|
||||
row, buttons = buttons[: self.max_width], buttons[self.max_width :]
|
||||
markup.append(list(row))
|
||||
if self.max_width > 0:
|
||||
while buttons:
|
||||
row, buttons = buttons[: self.max_width], buttons[self.max_width :]
|
||||
markup.append(list(row))
|
||||
else:
|
||||
markup.append(list(buttons))
|
||||
|
||||
self._markup = markup
|
||||
return self
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue