Skip to content

Commit 2dfd1ee

Browse files
committed
fix: prevent TypeError when rounding None value
- add a null check for `port.getValue()` before calling `round()`
1 parent 4b980fe commit 2dfd1ee

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

python/Scripts/mxdoc.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def main():
5050
for h in HEADERS:
5151
print('<th>' + h + '</th>')
5252
print('</tr>')
53-
inputList = nd.getActiveInputs() if opts.showInherited else nd.getInputs()
53+
inputList = nd.getActiveInputs() if opts.showInherited else nd.getInputs()
5454
tokenList = nd.getActiveTokens() if opts.showInherited else nd.getTokens()
5555
outputList = nd.getActiveOutputs() if opts.showInherited else nd.getOutputs()
5656
totalList = inputList + tokenList + outputList;
@@ -65,7 +65,7 @@ def main():
6565
infos.append('<b>'+ port.getName() + '</b>')
6666
infos.append(port.getType())
6767
val = port.getValue()
68-
if port.getType() == "float":
68+
if val is not None and port.getType() == "float":
6969
val = round(val, 6)
7070
infos.append(str(val))
7171
for attrname in ATTR_NAMES:
@@ -102,7 +102,7 @@ def main():
102102
infos.append('**'+ port.getName() + '**')
103103
infos.append(port.getType())
104104
val = port.getValue()
105-
if port.getType() == "float":
105+
if val is not None and port.getType() == "float":
106106
val = round(val, 6)
107107
infos.append(str(val))
108108
for attrname in ATTR_NAMES:

0 commit comments

Comments
 (0)