From 6e708a89225a8841e0dcd1247a975a962212f401 Mon Sep 17 00:00:00 2001 From: Glavin Wiechert Date: Fri, 2 Jan 2015 14:41:37 -0400 Subject: [PATCH] Closes #166. Add check for an Active Editor when beautifying --- lib/beautify.coffee | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/beautify.coffee b/lib/beautify.coffee index c9a0fa6..d92150e 100644 --- a/lib/beautify.coffee +++ b/lib/beautify.coffee @@ -116,6 +116,11 @@ beautify = ({onSave}) -> # Get current editor editor = atom.workspace.getActiveEditor() + # Check if there is an active editor + if not editor? + return @showError(new Error("Active Editor not found. " + "Please select a Text Editor first to beautify.")) + isSelection = !!editor.getSelectedText() # Get editor path and configurations for paths editedFilePath = editor.getPath()