mirror of
https://github.com/wailsapp/wails.git
synced 2026-03-14 14:45:49 +01:00
fix(darwin): prevent panic on empty Icon slice in dialogs
Change nil checks to length checks before accessing Icon[0] to prevent panic when Icon is an empty slice rather than nil. Fixes #3631 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
19b2ec7fbe
commit
b16458f121
1 changed files with 2 additions and 2 deletions
|
|
@ -392,13 +392,13 @@ func (m *macosDialog) show() {
|
|||
}
|
||||
var iconData unsafe.Pointer
|
||||
var iconLength C.int
|
||||
if m.dialog.Icon != nil {
|
||||
if len(m.dialog.Icon) > 0 {
|
||||
iconData = unsafe.Pointer(&m.dialog.Icon[0])
|
||||
iconLength = C.int(len(m.dialog.Icon))
|
||||
} else {
|
||||
// if it's an error, use the application Icon
|
||||
if m.dialog.DialogType == ErrorDialogType {
|
||||
if globalApplication.options.Icon != nil {
|
||||
if len(globalApplication.options.Icon) > 0 {
|
||||
iconData = unsafe.Pointer(&globalApplication.options.Icon[0])
|
||||
iconLength = C.int(len(globalApplication.options.Icon))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue