fix: nil check

This commit is contained in:
Siyuan Miao 2025-09-01 09:06:03 +02:00
parent e1815237eb
commit 4592269dd1
1 changed files with 10 additions and 0 deletions

View File

@ -109,6 +109,16 @@ func handleHidRPCKeyboardInput(message hidrpc.Message) (*usbgadget.KeysDownState
}
func reportHidRPC(params any, session *Session) {
if session == nil {
logger.Warn().Msg("session is nil, skipping reportHidRPC")
return
}
if !session.hidRPCAvailable || session.HidChannel == nil {
logger.Warn().Msg("HID RPC is not available, skipping reportHidRPC")
return
}
var (
message []byte
err error