nil pointer checks
nil pointer checks implemented
Change-Id: I15300bb77c7fefbe4c0d83f32f3b2cf0238cbf80
diff --git a/internal/pkg/core/device_handler.go b/internal/pkg/core/device_handler.go
index 0686fa3..610f3e3 100644
--- a/internal/pkg/core/device_handler.go
+++ b/internal/pkg/core/device_handler.go
@@ -2123,11 +2123,17 @@
 // Device Port-State: ACTIVE
 // Device Oper-State: ACTIVE
 func (dh *DeviceHandler) ReenableDevice(ctx context.Context, device *voltha.Device) error {
-	if _, err := dh.Client.ReenableOlt(log.WithSpanFromContext(context.Background(), ctx), new(oop.Empty)); err != nil {
-		if e, ok := status.FromError(err); ok && e.Code() == codes.Internal {
-			return olterrors.NewErrAdapter("olt-reenable-failed", log.Fields{"device-id": dh.device.Id}, err)
+	if dh.Client != nil {
+		if _, err := dh.Client.ReenableOlt(log.WithSpanFromContext(context.Background(), ctx), new(oop.Empty)); err != nil {
+			if e, ok := status.FromError(err); ok && e.Code() == codes.Internal {
+				return olterrors.NewErrAdapter("olt-reenable-failed", log.Fields{"device-id": dh.device.Id}, err)
+			}
 		}
+	} else {
+		return olterrors.NewErrAdapter("olt-reenable-failed", log.Fields{"device-id": dh.device.Id}, errors.New("nil device client"))
+
 	}
+
 	logger.Debug(ctx, "olt-reenabled")
 
 	// Update the all ports state on that device to enable
@@ -2346,9 +2352,15 @@
 
 // RebootDevice reboots the given device
 func (dh *DeviceHandler) RebootDevice(ctx context.Context, device *voltha.Device) error {
-	if _, err := dh.Client.Reboot(log.WithSpanFromContext(context.Background(), ctx), new(oop.Empty)); err != nil {
-		return olterrors.NewErrAdapter("olt-reboot-failed", log.Fields{"device-id": dh.device.Id}, err)
+	if dh.Client != nil {
+		if _, err := dh.Client.Reboot(log.WithSpanFromContext(context.Background(), ctx), new(oop.Empty)); err != nil {
+			return olterrors.NewErrAdapter("olt-reboot-failed", log.Fields{"device-id": dh.device.Id}, err)
+		}
+	} else {
+		return olterrors.NewErrAdapter("olt-reboot-failed", log.Fields{"device-id": dh.device.Id}, errors.New("nil device client"))
+
 	}
+
 	logger.Debugw(ctx, "rebooted-device-successfully", log.Fields{"device-id": device.Id})
 	return nil
 }