Skip to content

Commit c61daeb

Browse files
committed
Fix app.Plan.Override as nil
1 parent 29e47c0 commit c61daeb

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

app/app.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1130,14 +1130,19 @@ func (app *App) validate() error {
11301130

11311131
func (app *App) validatePlan() error {
11321132
cpuBurst := app.Plan.CPUBurst
1133+
planOverride := app.Plan.Override
11331134

11341135
if cpuBurst == nil {
11351136
cpuBurst = &appTypes.CPUBurst{}
11361137
}
11371138

1139+
if planOverride == nil {
1140+
planOverride = &appTypes.PlanOverride{}
1141+
}
1142+
11381143
if (cpuBurst.MaxAllowed != 0) &&
1139-
(app.Plan.Override.CPUBurst != nil) &&
1140-
(*app.Plan.Override.CPUBurst > app.Plan.CPUBurst.MaxAllowed) {
1144+
(planOverride.CPUBurst != nil) &&
1145+
(*planOverride.CPUBurst > cpuBurst.MaxAllowed) {
11411146

11421147
msg := fmt.Sprintf("CPU burst exceeds the maximum allowed by plan %q", app.Plan.Name)
11431148
return &tsuruErrors.ValidationError{Message: msg}

0 commit comments

Comments
 (0)