Skip to content

Commit 9a2aba9

Browse files
committed
cleanup set-default
1 parent a986ea0 commit 9a2aba9

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/lib/bootloader/bls_sections.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ def default
2828
return ""
2929
else
3030
entry = @data.select {|d| d["id"] == @default }
31+
if entry.
3132
return entry.first["title"]
3233
end
3334
end
@@ -36,12 +37,11 @@ def default
3637
# @param [String] value of new boot title to boot
3738
# @note to write it to system use #write later
3839
def default=(value)
39-
# empty value mean no default specified
40-
if !all.empty? && !all.include?(value)
40+
entry = @data.select {|d| d["title"] == value }
41+
if entry.empty?
4142
log.warn "Invalid value '#{value}'"
4243
@default = ""
4344
else
44-
entry = @data.select {|d| d["title"] == value }
4545
@default = entry.first["id"]
4646
log.info "set new default to '#{value.inspect}' --> '#{@default}'"
4747
end

0 commit comments

Comments
 (0)