diff options
| author | Ulf Magnusson <ulfalizer@gmail.com> | 2018-11-02 03:18:28 +0100 |
|---|---|---|
| committer | Ulf Magnusson <ulfalizer@gmail.com> | 2018-11-02 03:53:02 +0100 |
| commit | db60270a2d498e59d76f072298aa9d45a03136f2 (patch) | |
| tree | 54b983341e3c06563c2cc503e6b10f4b8926aeab | |
| parent | 0e6cd82908f5c649e15e6a63ad77a94f627449d2 (diff) | |
menuconfig: Fix crash when toggling symbols without a type
Trying to toggle the following symbol crashed the menuconfig:
config FOO
prompt "foo"
Symbols defined without a type are pointless and generate a warning
(particular definition locations can omit the type, but some definition
location should give a type if the symbol is defined in multiple
locations). We should never crash for them though.
Fix the crash. The code assumed that the symbol's current value would
appear in Symbol.assignable, like for a visible bool/tristate, but
symbols without types get their name as their value.
Also skip printing "(NEW)" next to symbols without a type.
| -rwxr-xr-x | menuconfig.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/menuconfig.py b/menuconfig.py index 733e6e5..ad3c175 100755 --- a/menuconfig.py +++ b/menuconfig.py @@ -1446,7 +1446,7 @@ def _change_node(node): # case: .assignable can be (2,) while .tri_value is 0. _set_val(sc, sc.assignable[0]) - else: + elif sc.assignable: # Set the symbol to the value after the current value in # sc.assignable, with wrapping val_index = sc.assignable.index(sc.tri_value) @@ -2742,8 +2742,10 @@ def _node_str(node): sym = node.item # Print "(NEW)" next to symbols without a user value (from e.g. a - # .config), but skip it for choice symbols in choices in y mode + # .config), but skip it for choice symbols in choices in y mode, + # and for symbols of UNKNOWN type (which generate a warning though) if sym.user_value is None and \ + sym.type != UNKNOWN and \ not (sym.choice and sym.choice.tri_value == 2): s += " (NEW)" |
