handle getDirectChannel returning nil,nil (#4487)

This commit is contained in:
Doug Lauder 2023-01-18 17:06:59 -05:00 committed by GitHub
parent dd1f81c1e8
commit 333b448705
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -53,7 +53,7 @@ func (pd *PluginDelivery) getDirectChannelID(teamID string, subscriberID string,
return "", fmt.Errorf("cannot find user: %w", err)
}
channel, err := pd.getDirectChannel(teamID, user.Id, botID)
if err != nil {
if err != nil || channel == nil {
return "", fmt.Errorf("cannot get direct channel: %w", err)
}
return channel.Id, nil