Repository: spyder-ide/spyder

Issue:
Error when launching a new Editor window from the options in the menu.
## Description of your problem

**What steps will reproduce the problem?**

1. Click the "New window" option from the menu of the editor.
2. The new window is created but also a traceback appear.


**What is the expected output? What do you see instead?**

The new window without errors

**Please provide any additional information below**

```
Traceback (most recent call last):
  File "C:\Users\Daniel\Anaconda3\lib\site-packages\spyder\plugins\editor.py", line 1481, in refresh_save_all_action
    for finfo in editorstack.data)
AttributeError: 'NoneType' object has no attribute 'data'
Traceback (most recent call last):
  File "C:\Users\Daniel\Anaconda3\lib\site-packages\spyder\plugins\editor.py", line 1481, in refresh_save_all_action
    for finfo in editorstack.data)
AttributeError: 'NoneType' object has no attribute 'data'
Traceback (most recent call last):
  File "C:\Users\Daniel\Anaconda3\lib\site-packages\spyder\plugins\editor.py", line 1481, in refresh_save_all_action
    for finfo in editorstack.data)
AttributeError: 'NoneType' object has no attribute 'data'
Traceback (most recent call last):
  File "C:\Users\Daniel\Anaconda3\lib\site-packages\spyder\plugins\editor.py", line 1481, in refresh_save_all_action
    for finfo in editorstack.data)
AttributeError: 'NoneType' object has no attribute 'data'
Traceback (most recent call last):
  File "C:\Users\Daniel\Anaconda3\lib\site-packages\spyder\plugins\editor.py", line 1481, in refresh_save_all_action
    for finfo in editorstack.data)
AttributeError: 'NoneType' object has no attribute 'data'
Traceback (most recent call last):
  File "C:\Users\Daniel\Anaconda3\lib\site-packages\spyder\plugins\editor.py", line 1481, in refresh_save_all_action
    for finfo in editorstack.data)
AttributeError: 'NoneType' object has no attribute 'data'
```

## Versions and main components

* Spyder Version: 3.1.2
* Python Version: 3.5.2
* Operating system: Windows 8.1 64bits



Discussion:

Resolving patch:
diff --git a/spyder/plugins/editor.py b/spyder/plugins/editor.py
--- a/spyder/plugins/editor.py
+++ b/spyder/plugins/editor.py
@@ -1475,9 +1475,10 @@ def refresh_file_dependent_actions(self):
     def refresh_save_all_action(self):
         """Enable 'Save All' if there are files to be saved"""
         editorstack = self.get_current_editorstack()
-        state = any(finfo.editor.document().isModified()
-                    for finfo in editorstack.data)
-        self.save_all_action.setEnabled(state)
+        if editorstack:
+            state = any(finfo.editor.document().isModified()
+                        for finfo in editorstack.data)
+            self.save_all_action.setEnabled(state)
             
     def update_warning_menu(self):
         """Update warning list menu"""


Test patch:
diff --git a/continuous_integration/travis/build_test.sh b/continuous_integration/travis/build_test.sh
--- a/continuous_integration/travis/build_test.sh
+++ b/continuous_integration/travis/build_test.sh
@@ -9,7 +9,7 @@ cd $FULL_SPYDER_CLONE
 if [ $TRAVIS_PULL_REQUEST != "false" ] ; then
     git checkout travis_pr_$TRAVIS_PULL_REQUEST
 else
-    git checkout master
+    git checkout $TRAVIS_BRANCH
 fi
 
 # -- Build package
diff --git a/continuous_integration/travis/modules_test.sh b/continuous_integration/travis/modules_test.sh
--- a/continuous_integration/travis/modules_test.sh
+++ b/continuous_integration/travis/modules_test.sh
@@ -11,7 +11,7 @@ cd $FULL_SPYDER_CLONE
 if [ $TRAVIS_PULL_REQUEST != "false" ] ; then
     git checkout travis_pr_$TRAVIS_PULL_REQUEST
 else
-    git checkout master
+    git checkout $TRAVIS_BRANCH
 fi
 
 # Depth 1