Skip to content

Commit 5326795

Browse files
committed
🧹 improve nil pointer detection
1 parent bea3691 commit 5326795

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

providers/os/provider/detector.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ func appendRelatedAssetsFromFingerprint(f *id.PlatformFingerprint, a *inventory.
153153

154154
func (s *Service) assetName(asset *inventory.Asset, conn shared.Connection) {
155155
// for macOS we want to use the computer name, therefore we detect the computer name
156-
if asset.Platform.Name == "macos" {
156+
if asset != nil && asset.Platform != nil && asset.Platform.Name == "macos" {
157157
// run command to get computer name and use it as asset name
158158
f, err := conn.FileSystem().Open("/Library/Preferences/SystemConfiguration/preferences.plist")
159159
if err == nil {

0 commit comments

Comments
 (0)