hotfix: position or zoom can be nil

This commit is contained in:
Cedric Verstraeten
2024-01-03 13:37:38 +01:00
parent 95ed1f0e97
commit deb0a3ff1f

View File

@@ -311,7 +311,7 @@ func GetPositionFromDevice(configuration models.Configuration) (xsdonvif.PTZVect
if err == nil {
// Get the PTZ configurations from the device
position, err := GetPosition(device, token)
if err == nil {
if err == nil && position.PanTilt != nil && position.Zoom != nil {
// float to string
x := strconv.FormatFloat(position.PanTilt.X, 'f', 6, 64)
y := strconv.FormatFloat(position.PanTilt.Y, 'f', 6, 64)