Skip to content

Use pcall in OnIconChanged for proper error handling - #113

Merged
ryanlua merged 4 commits into
ryanlua:mainfrom
Epixerty:patch-1
Oct 1, 2025
Merged

Use pcall in OnIconChanged for proper error handling#113
ryanlua merged 4 commits into
ryanlua:mainfrom
Epixerty:patch-1

Conversation

@Epixerty

@Epixerty Epixerty commented Oct 1, 2025

Copy link
Copy Markdown
Contributor

Rather than using task.wait() this should be wrapped in a pcall to prevent filling the console with errors. It's not guaranteed to exist even after 1 frame.

By the way, this current task.wait() "fix" isn't implemented in the current wally release at least, I would appreciate if you could merge this PR or at least have another wally release since that's better than nothing

Refactor OnIconChanged function to use pcall for safer execution.

Signed-off-by: epix <71335972+Epixerty@users.noreply.github.com>
@ryanlua
ryanlua requested a review from Copilot October 1, 2025 07:56
@ryanlua ryanlua self-assigned this Oct 1, 2025
@ryanlua ryanlua added the bug Something isn't working label Oct 1, 2025

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR improves error handling in the OnIconChanged function by replacing a task.wait() call with proper pcall error handling to prevent console errors when StarterGui:GetCore("TopbarEnabled") might not be available.

  • Replaces task.wait() with pcall to handle potential errors gracefully
  • Adds early return when the operation fails to prevent further execution with invalid state

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread src/init.luau Outdated
@ryanlua ryanlua linked an issue Oct 1, 2025 that may be closed by this pull request
@ryanlua ryanlua added this to the v1.4.1 milestone Oct 1, 2025
Signed-off-by: Ryan Luu <ryan.luu@ryanluu.dev>
Signed-off-by: Ryan Luu <ryan.luu@ryanluu.dev>
@ryanlua
ryanlua merged commit 8078ad9 into ryanlua:main Oct 1, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Call to disable the TopBar may fail initially

3 participants