Skip to content

Commit d2c14c7

Browse files
committed
Merge pull request #764 from taimir/bugfix-rs-daemonsets
Bugfix #762 - nullpointer dereference at RS / Deployments lists
2 parents 9a40438 + 140b6df commit d2c14c7

File tree

4 files changed

+14
-4
lines changed

4 files changed

+14
-4
lines changed

src/app/backend/resource/deployment/deploymentlist.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,10 @@ func GetDeploymentListFromChannels(channels *common.ResourceChannels) (
7171
if ok && statusErr.ErrStatus.Reason == "NotFound" {
7272
// NotFound - this means that the server does not support Deployment objects, which
7373
// is fine.
74-
return nil, nil
74+
emptyList := &DeploymentList{
75+
Deployments: make([]Deployment, 0),
76+
}
77+
return emptyList, nil
7578
}
7679
return nil, err
7780
}

src/app/backend/resource/replicaset/replicasetlist.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,10 @@ func GetReplicaSetListFromChannels(channels *common.ResourceChannels) (
7171
if ok && statusErr.ErrStatus.Reason == "NotFound" {
7272
// NotFound - this means that the server does not support Replica Set objects, which
7373
// is fine.
74-
return nil, nil
74+
emptyList := &ReplicaSetList{
75+
ReplicaSets: make([]ReplicaSet, 0),
76+
}
77+
return emptyList, nil
7578
}
7679
return nil, err
7780
}

src/test/backend/resource/deployment/deploymentlist_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,9 @@ func TestGetDeploymentListFromChannels(t *testing.T) {
7474
extensions.DeploymentList{},
7575
&k8serrors.StatusError{ErrStatus: unversioned.Status{Reason: "NotFound"}},
7676
&api.PodList{},
77-
nil,
77+
&DeploymentList{
78+
Deployments: make([]Deployment, 0),
79+
},
7880
nil,
7981
},
8082
{

src/test/backend/resource/replicaset/replicasetlist_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,9 @@ func TestGetReplicaSetListFromChannels(t *testing.T) {
7474
extensions.ReplicaSetList{},
7575
&k8serrors.StatusError{ErrStatus: unversioned.Status{Reason: "NotFound"}},
7676
&api.PodList{},
77-
nil,
77+
&ReplicaSetList{
78+
ReplicaSets: make([]ReplicaSet, 0),
79+
},
7880
nil,
7981
},
8082
{

0 commit comments

Comments
 (0)