mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
MessageBox: Avoid potential divide-by-zero for boxes with no buttons
This commit is contained in:
parent
b292ba215a
commit
44a84e3a4d
1 changed files with 7 additions and 1 deletions
|
|
@ -66,7 +66,13 @@ std::unique_ptr<ScopedMessageBoxInterface> ScopedMessageBoxInterface::create (co
|
|||
}
|
||||
|
||||
private:
|
||||
static int map (int button, int numButtons) { return (button + numButtons - 1) % numButtons; }
|
||||
static int map (int button, int numButtons)
|
||||
{
|
||||
if (numButtons <= 0)
|
||||
return 0;
|
||||
|
||||
return (button + numButtons - 1) % numButtons;
|
||||
}
|
||||
|
||||
std::unique_ptr<ScopedMessageBoxInterface> inner;
|
||||
int numButtons = 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue