Skip to content

Commit

Permalink
fix: broken ID generation lead to first icon always being 0x0000
Browse files Browse the repository at this point in the history
Fixes #30
  • Loading branch information
benthillerkus committed Feb 24, 2023
1 parent 10fcec9 commit 1ba0991
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/src/imperative.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,10 @@ class TrayIcon {
/// to identify the icon and address it
/// when it has been clicked.
static Id _newId() {
Id temp = 0;
while (_allIcons.containsKey(temp)) {
temp = _random.nextInt(_kMaximumId - _kMinimumId);
while (true) {
Id id = _random.nextInt(_kMaximumId - _kMinimumId);
if (!_allIcons.containsKey(id)) return id;
}
return temp;
}

/// The id used by Windows to distinguish this icon.
Expand Down

0 comments on commit 1ba0991

Please sign in to comment.