Resolve "Segmentation fault through plugin client"
Compare changes
- Malte Bauch authored
A response of grpc calls within methods of DeviceModelClient is nil as soon as an error occured within the call. In some methods values of the response were directly accessed and returned. This can lead to a segmentation fault if the response is nil. Catching errors should prevent this.
+ 27
− 4
@@ -27,6 +27,7 @@ func (m *DeviceModelClient) Unmarshal(json []byte, path *gpb.Path) error {
@@ -38,6 +39,7 @@ func (m *DeviceModelClient) SetNode(path *gpb.Path, value *gpb.TypedValue) error
@@ -50,7 +52,11 @@ func (m *DeviceModelClient) GetNode(path *gpb.Path, requestForIntendedState bool
@@ -60,6 +66,7 @@ func (m *DeviceModelClient) DeleteNode(path *gpb.Path) error {
@@ -71,7 +78,11 @@ func (m *DeviceModelClient) Model(filterReadOnly bool) ([]byte, error) {
@@ -82,7 +93,11 @@ func (m *DeviceModelClient) Diff(original, modified []byte) (*gpb.Notification,
@@ -95,7 +110,11 @@ func (m *DeviceModelClient) ValidateChange(operation mnepb.ApiOperation, path *g
@@ -106,6 +125,10 @@ func (m *DeviceModelClient) PruneConfigFalse(value []byte) ([]byte, error) {