This commit is a workaround for issue atom/atom#12575 in Atom core, which was causing uncaught TypeError: Cannot read property 'screenExtent' of undefined exceptions to be thrown by Atom, breaking it until the program was restarted. auto-detect-indentation was inadvertently triggering this bug, causing it to crash Atom in certain circumstances.
This commit changes IndentationManager::setIndentation() to check if indentation.tabLength is null, and to only call editor.setTabLength() if it isn't. I also took the opportunity to make the existing null check of indentation.softTabs to be more idiomatic CoffeeScript.
There should be no other behavior change to auto-detect-indentation aside from not trigger unhandled exceptions in Atom.
This commit is a workaround for issue atom/atom#12575 in Atom core, which was causing uncaught
TypeError: Cannot read property 'screenExtent' of undefined
exceptions to be thrown by Atom, breaking it until the program was restarted. auto-detect-indentation was inadvertently triggering this bug, causing it to crash Atom in certain circumstances.The bug was triggered by passing
null
toeditor.setTabLength()
. You can see details of the bug in the discussion at https://github.com/atom/atom/issues/12575 .This commit changes
IndentationManager::setIndentation()
to check ifindentation.tabLength
isnull
, and to only calleditor.setTabLength()
if it isn't. I also took the opportunity to make the existing null check ofindentation.softTabs
to be more idiomatic CoffeeScript.There should be no other behavior change to auto-detect-indentation aside from not trigger unhandled exceptions in Atom.