Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 47 #71

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Issue 47 #71

wants to merge 3 commits into from

Conversation

matippetts
Copy link

@matippetts matippetts commented Jan 26, 2019

This addresses issue #47 by adding a sanity-check for circumstances where Workspace.getActiveTextEditor() or TextEditor.getPath() returns 'undefined'. It also changes the flow of control to prevent exceptions from propagating up the call stack.

Under some conditions, Atom enables the 'atom-text-editor' 
context-menu, even though the active Pane item is not a 
TextEditor instance. 

In this circumstance, @OpenEditor can be called, but 
workspace.getActiveTextEditor() will return 'undefined'.

This commit introduces a sanity check against this case
and also changes the flow of control to prevent the error 
from propagating.
getFilePath() is expected to return a String, but this is not 
guaranteed. 
[TextEditor.getPath()](https://atom.io/docs/api/v1.34.0/TextEditor#instance-getPath) 
returns `undefined` if the backing TextBuffer has never been saved.
@matippetts matippetts changed the title Issue 47 Issue #47 Jan 26, 2019
@matippetts matippetts changed the title Issue #47 Issue 47 Jan 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant