   # Automatic conversion, based on scope
   autoConvert: ->
     editor = @workspace.getActiveTextEditor()
+    if typeof editor is "undefined"
+      @atom.beep()
+      return
     scope = editor.getGrammar().scopeName
 
     if scope is "source.coffee"

    # Write back to editor and change scope
    editor.setText(output)
    editor.setGrammar(@grammars.grammarForScopeName('source.coffee'))



  jsonToCson: ->
    editor = @workspace.getActiveTextEditor()
    if typeof editor is "undefined"
      @atom.beep()
      return
    text = editor.getText()

    # Conversion
