rs.GetLinetype() error in V8

Running the following code:

import rhinoscriptsyntax as rs
lt_str=rs.GetLinetype()

This brings up the linetype choice dialog. If you hit Cancel in V8, you get the following error:
Message: 'NoneType' object has no attribute 'Name'

In V7, it just stops without an error. This is running from the old EditPythonScript editor.

I tracked it down to what V7 and V8 return when one hits the Cancel button in the dialog (the dialog should return a Guid if one actually chooses a linetype).

V7 returns None, which is equal to "" so the method also returns None:

V8 returns a System.Guid.Unset when the Cancel button is pressed. As this does not equal "", the method does not return at that point, so it then errors out because the Guid.Unset does not have an attribute .Name.

So, either in V8 the
Rhino.UI.Dialogs.ShowLineTypes("Select Linetype", "", scriptcontext.doc)
method needs to be changed to return None if Cancel is pressed like in V7, or, the line after needs to be modified to check if a Guid.Unset is returned and return None after.

@Alain (I guess this is for you)

Hi Mitch,
RH-80347
Thanks!

RH-80347 is fixed in Rhino 8 Service Release 5 Release Candidate