From b323a17cefd436faef3e8ad8390ff88d1deb8ecf Mon Sep 17 00:00:00 2001 From: Lin Liu Date: Tue, 19 Sep 2023 08:39:32 +0000 Subject: [PATCH] Set MenuEntry extra if it has valid value 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 --- xcp/bootloader.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/xcp/bootloader.py b/xcp/bootloader.py index e5673d6c..353cc7ff 100644 --- a/xcp/bootloader.py +++ b/xcp/bootloader.py @@ -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: