Fix shceduler_handler portRange mapping
@@ -42,10 +42,7 @@ func (h *SchedulerHandler) ListSchedulers(ctx context.Context, message *api.Empt
Name: entity.Name,
Game: entity.Game,
State: entity.State,
- PortRange: &api.PortRange{
- Start: entity.PortRange.Start,
- End: entity.PortRange.End,
- },
+ PortRange: getPortRange(entity.PortRange),
}
schedulers[i] = &scheduler
}
@@ -154,3 +151,14 @@ func (h *SchedulerHandler) fromOperationToResponse(entity *operation.Operation)
SchedulerName: entity.SchedulerName,
}, nil
}
+
+func getPortRange(portRange *entities.PortRange) *api.PortRange {
+ if portRange != nil {
+ return &api.PortRange{
+ Start: portRange.Start,
+ End: portRange.End,
+ }
+ }
+
+ return nil
+}
