Skip to content

Commit 30c4b73

Browse files
committed
add invalid vaule check
1 parent 2b3f12f commit 30c4b73

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

models/unit/unit.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ func LoadUnitConfig() {
154154
DisabledRepoUnits = FindUnitTypes(setting.Repository.DisabledRepoUnits...)
155155
// Check that must units are not disabled
156156
for i, disabledU := range DisabledRepoUnits {
157-
if !disabledU.CanDisable() {
157+
if !disabledU.CanDisable() || disabledU.IsInvalid() {
158158
log.Warn("Not allowed to global disable unit %s", disabledU.String())
159159
DisabledRepoUnits = append(DisabledRepoUnits[:i], DisabledRepoUnits[i+1:]...)
160160
}
@@ -176,6 +176,11 @@ func (u Type) UnitGlobalDisabled() bool {
176176
return false
177177
}
178178

179+
// IsInvalid checks if this unit type is invalid.
180+
func (u *Type) IsInvalid() bool {
181+
return *u == TypeInvalid
182+
}
183+
179184
// CanDisable checks if this unit type can be disabled.
180185
func (u *Type) CanDisable() bool {
181186
for _, mu := range MustRepoUnits {

0 commit comments

Comments
 (0)