Skip to content

Guard StatusBarManager methods against pre-build AttributeError#241

Merged
clstaudt merged 2 commits intostreamlinefrom
copilot/sub-pr-239-again
Mar 12, 2026
Merged

Guard StatusBarManager methods against pre-build AttributeError#241
clstaudt merged 2 commits intostreamlinefrom
copilot/sub-pr-239-again

Conversation

Copy link
Contributor

Copilot AI commented Mar 10, 2026

StatusBarManager.update_warnings() and try_update() accessed self.bar unconditionally, but self.bar is only assigned in build(). Any call before build() would raise AttributeError.

Changes

  • __init__: initialize self.bar: Optional[Container] = None so the attribute always exists at construction time
  • update_warnings(): wrap the bar.bgcolor update in if self.bar is not None: — warning item visibility is still updated regardless
  • try_update(): early-return if self.bar is None instead of letting the bare except swallow the error
# Before: AttributeError silently swallowed
def try_update(self):
    try:
        self.bar.update()  # AttributeError if build() not yet called
    except Exception:
        pass

# After: explicit guard, no silent failure
def try_update(self):
    if self.bar is None:
        return
    try:
        self.bar.update()
    except Exception:
        pass

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: clstaudt <875194+clstaudt@users.noreply.github.com>
Copilot AI changed the title [WIP] Address changes based on feedback for streamlined UI/UX Guard StatusBarManager methods against pre-build AttributeError Mar 10, 2026
@clstaudt clstaudt marked this pull request as ready for review March 12, 2026 21:23
@clstaudt clstaudt merged commit 851691a into streamline Mar 12, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants