Fix panic on reading nil TLV8 #1507

This commit is contained in:
Alex X
2025-02-24 21:55:10 +03:00
parent 90544ba713
commit 45b223a2ef
2 changed files with 19 additions and 3 deletions
+9
View File
@@ -2,12 +2,21 @@ package camera
import (
"encoding/base64"
"strings"
"testing"
"github.com/AlexxIT/go2rtc/pkg/hap"
"github.com/stretchr/testify/require"
)
func TestNilCharacter(t *testing.T) {
var res SetupEndpoints
char := &hap.Character{}
err := char.ReadTLV8(&res)
require.NotNil(t, err)
require.NotNil(t, strings.Contains(err.Error(), "can't read value"))
}
type testTLV8 struct {
name string
value string