This is an automated email from the ASF dual-hosted git repository.

astefanutti pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-k.git

commit 495c620abe1dee672fface09829ae118fe644083
Author: Antonin Stefanutti <[email protected]>
AuthorDate: Thu Oct 24 18:33:51 2019 +0200

    fix(quarkus): Avoid nil pointer dereference panic on catalog lookup
---
 pkg/metadata/metadata_dependencies_test.go | 1 +
 pkg/util/camel/camel_util.go               | 3 +++
 2 files changed, 4 insertions(+)

diff --git a/pkg/metadata/metadata_dependencies_test.go 
b/pkg/metadata/metadata_dependencies_test.go
index a3654f9..2268cfb 100644
--- a/pkg/metadata/metadata_dependencies_test.go
+++ b/pkg/metadata/metadata_dependencies_test.go
@@ -131,6 +131,7 @@ func TestDependenciesQuarkus(t *testing.T) {
 
        catalog, err := camel.QuarkusCatalog()
        assert.Nil(t, err)
+       assert.NotNil(t, catalog)
 
        meta := Extract(catalog, code)
 
diff --git a/pkg/util/camel/camel_util.go b/pkg/util/camel/camel_util.go
index a368284..e3949ef 100644
--- a/pkg/util/camel/camel_util.go
+++ b/pkg/util/camel/camel_util.go
@@ -56,6 +56,9 @@ func findBestMatch(catalogs []v1alpha1.CamelCatalog, 
camelVersion string, runtim
                        return nil, nil
                }
                for _, c := range cc {
+                       if c.Catalog.Spec.RuntimeProvider == nil || 
c.Catalog.Spec.RuntimeProvider.Quarkus == nil {
+                               continue
+                       }
                        qv, err := 
semver.NewVersion(c.Catalog.Spec.RuntimeProvider.Quarkus.QuarkusVersion)
                        if err != nil {
                                log.Debugf("Invalid semver version (quarkus) 
%s", qv)

Reply via email to