Closed Vladius25 closed 1 year ago
The next line of code leads to panic:
player, err := media.NewMediaPlayer1(playerPath)
Part of stacktrace:
panic: reflect: Elem of invalid type media.Track goroutine 1 [running]: reflect.(*rtype).Elem(0x559ca0?) /usr/lib/golang/src/reflect/type.go:972 +0x134 github.com/muka/go-bluetooth/util.mapStructField({0x5460c0, 0xc0001b6780}, {0xc00001c82a, 0x5}, {{{0xc00001cac0?, 0x510433?}}, {0x53a800?, 0xc000079020?}}) /home/vladius/go/pkg/mod/github.com/muka/go-bluetooth@v0.0.0-20220830075246-0746e3a1ea53/util/map_struct.go:92 +0x388 github.com/muka/go-bluetooth/util.MapToStruct({0x5460c0, 0xc0001b6780}, 0x26?) /home/vladius/go/pkg/mod/github.com/muka/go-bluetooth@v0.0.0-20220830075246-0746e3a1ea53/util/map_struct.go:128 +0xad github.com/muka/go-bluetooth/bluez.(*Client).GetProperties(0xc0001d8c40, {0x5460c0, 0xc0001b6780}) /home/vladius/go/pkg/mod/github.com/muka/go-bluetooth@v0.0.0-20220830075246-0746e3a1ea53/bluez/client.go:119 +0x21d github.com/muka/go-bluetooth/bluez/profile/media.(*MediaPlayer1).GetProperties(0xc0001cd200)
The actual problem locates on line 92:
https://github.com/muka/go-bluetooth/blob/0746e3a1ea53986b382725bdb922bac0da6a93f1/util/map_struct.go#L90-L93
The reason is Elem() doesn't support structs and causes panic during processing field Track (type media.Track) of media.MediaPlayer1Properties.
Elem()
Track
media.Track
media.MediaPlayer1Properties
Thank you, merged your PR let me know if this still happens
The next line of code leads to panic:
Part of stacktrace:
The actual problem locates on line 92:
https://github.com/muka/go-bluetooth/blob/0746e3a1ea53986b382725bdb922bac0da6a93f1/util/map_struct.go#L90-L93
The reason is
Elem()
doesn't support structs and causes panic during processing fieldTrack
(typemedia.Track
) ofmedia.MediaPlayer1Properties
.