fix(spotify): check error presence before handling

relates to #2031
This commit is contained in:
Jan De Dobbeleer 2022-04-05 13:11:23 +02:00 committed by Jan De Dobbeleer
parent f9efe17da3
commit 835b80d9bf

View file

@ -110,7 +110,11 @@ func queryWindowTitles(processName, windowTitleRegex string) (string, error) {
// In our case, title will equal "" or the title of the window anyway
err := enumWindows(cb, 0)
if len(title) == 0 {
return "", errors.New("no matching window title found\n" + err.Error())
var message string
if err != nil {
message = err.Error()
}
return "", errors.New("no matching window title found\n" + message)
}
return title, nil
}