mvnmgrx/kiutils

FpItems: `stroke` token may be None when used to generate S-Expression

Closed this issue · 0 comments

In src/kiutils/items/fpitems.py:

The stroke token is used when the width token is None, but without prior checking if it was even set during parsing. The following snippet is used several times in this file:

        if self.width is not None:
            width = f' (width {self.width})'
        else:
            width = f' {self.stroke.to_sexpr(indent=0, newline=False)}'

The self.stroke member is optional and may be None at this point. Add a check before using it to fix this.