Fixed crash with invalid target config name in beam commands

This commit is contained in:
Philipp Wolfer 2023-12-09 22:29:15 +01:00
parent 76fd7cfeb4
commit 1698568d0e
No known key found for this signature in database
GPG key ID: 8FDF744D4919943B
2 changed files with 6 additions and 1 deletions

View file

@ -64,8 +64,12 @@ func (l BackendList) Swap(i, j int) {
type Capability = string
func ResolveBackend[T interface{}](config *config.ServiceConfig) (T, error) {
backend, err := backendWithConfig(config)
var result T
if config == nil {
err := fmt.Errorf("config must not be nil")
return result, err
}
backend, err := backendWithConfig(config)
if err != nil {
return result, err
}