Kapiainen / SublimePapyrus

A Sublime Text 2 and 3 package for the Papyrus scripting language.
MIT License
47 stars 8 forks source link

New linter crash #36

Closed jimkaiseriv closed 7 years ago

jimkaiseriv commented 7 years ago

I'm really not sure what caused this one. I didn't notice the crash for a little while, and I can't say exactly what preceded it. Hopefully the console error is useful to you, though.

Exception in thread Thread-3490: Traceback (most recent call last): File ".\threading.py", line 532, in __bootstrap_inner File ".\threading.py", line 736, in run File ".\Plugin.py", line 413, in Linter File "C:\Users\Kaisers\AppData\Roaming\Sublime Text 2\Packages\SublimePapyrus - Skyrim\Linter.py", line 530, in Process if self.Statement() >= 0: File "C:\Users\Kaisers\AppData\Roaming\Sublime Text 2\Packages\SublimePapyrus - Skyrim\Linter.py", line 780, in Statement elif self.token.type == self.KW_STATE or (self.token.type == self.KW_AUTO and self.Peek().type == self.KW_STATE): AttributeError: 'NoneType' object has no attribute 'type'

Kapiainen commented 7 years ago

I think I know what is happening. I'll have a fix up as soon as I can.

Kapiainen commented 7 years ago

Version 2.6.10 fixes the issue. The issue was that just typing 'auto' meant that the linter had to peek one token forward to check if it was followed by 'state', but the peek function returned None since 'auto' was the only thing on the line. All instances of calling the peek function, except for this particular one, checked the return value before trying to use it.

jimkaiseriv commented 7 years ago

I'm amazed by your quick response! Your explanation fits what I experienced, because I had defined an auto state not long before I noticed the crash.

Thanks!

Kapiainen commented 7 years ago

No problem, would have been tricky figuring it out without the stack trace.