Skip to content

Commit 2137817

Browse files
committed
Check clone params before copying
1 parent d9bcd10 commit 2137817

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

command/thing/create.go

+6-2
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,12 @@ func cloneThing(client iot.Client, thingID string) (map[string]interface{}, erro
7272
}
7373

7474
thing := make(map[string]interface{})
75-
thing["device_id"] = clone.DeviceId
76-
thing["properties"] = clone.Properties
75+
if clone.DeviceId != "" {
76+
thing["device_id"] = clone.DeviceId
77+
}
78+
if clone.Properties != nil {
79+
thing["properties"] = clone.Properties
80+
}
7781

7882
return thing, nil
7983
}

0 commit comments

Comments
 (0)