Skip to content

Commit

Permalink
Set MenuEntry extra if it has valid value
Browse files Browse the repository at this point in the history
MenuEntry has `extra` attr defined to `None` in its constructor,
Thus always got `extra` attr, and default to `None`. Try to access
`extra` attr would never got `AttributeError`, and thus got value
default to `None`. However, the expected default value should be ` `

Set `extra` by checking whether MenuEntry `extra` got a valid value

Signed-off-by: Lin Liu <[email protected]>
  • Loading branch information
liulinC committed Sep 22, 2023
1 parent f703ff7 commit b323a17
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions xcp/bootloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -586,11 +586,7 @@ def writeGrub2(self, dst_file = None):
if text:
print("\n".join(text), file=fh)

extra = ' '
try:
extra = m.extra
except AttributeError:
pass
extra = m.extra if m.extra else ' '
print("menuentry '%s'%s{" % (m.title, extra), file=fh)

try:
Expand Down

0 comments on commit b323a17

Please sign in to comment.