← all notes
wailsapp/wails·

A nil panic in Wails when you Quit before Run

A wails user filed issue #5452: their app called Application.Quit() inside a startup-failure path, before Run() had a chance to set up the inner application. The result was a nil deref deep inside Quit, which took down the host process.

The fix is the one the reporter suggested in the issue: guard Shutdown() on the inner app being non-nil.

func (a *App) Quit() {
    if a.application != nil {
        a.application.Shutdown()
    }
}

What I liked about this bug is that it's a totally reasonable user mistake. You'd write that “quit early on bootstrap failure” code in five seconds and never think twice about it. But the framework was punishing it with a panic. Nil-guarding the public API turns a hard crash into a no-op, which is the right default for a method that runs before initialization completes.

Added the changelog entry under [Unreleased] per the v2 contributor checklist, opened the PR with a tight description, and the wails team merged it the same day.