diff --git a/appinventor/appengine/src/com/google/appinventor/client/Ode.java b/appinventor/appengine/src/com/google/appinventor/client/Ode.java index 02352615377..e287f57c843 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/Ode.java +++ b/appinventor/appengine/src/com/google/appinventor/client/Ode.java @@ -562,8 +562,17 @@ private void openPreviousProject() { return; } final String value = userSettings.getSettings(SettingsConstants.USER_GENERAL_SETTINGS) - .getPropertyValue(SettingsConstants.GENERAL_SETTINGS_CURRENT_PROJECT_ID); - openProject(value); + .getPropertyValue(SettingsConstants.GENERAL_SETTINGS_CURRENT_PROJECT_ID); + if (value.isEmpty()) { + switchToProjectsView(); + return; + } + long projectId = Long.parseLong(value); + if (projectManager.isProjectInTrash(projectId)) { + switchToProjectsView(); + } else { + openProject(value); + } } private void openProject(String projectIdString) { diff --git a/appinventor/appengine/src/com/google/appinventor/client/explorer/project/ProjectManager.java b/appinventor/appengine/src/com/google/appinventor/client/explorer/project/ProjectManager.java index 78fc69072de..28605963018 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/explorer/project/ProjectManager.java +++ b/appinventor/appengine/src/com/google/appinventor/client/explorer/project/ProjectManager.java @@ -239,4 +239,9 @@ private void fireProjectDeleted(Project project) { listener.onProjectDeleted(project); } } + + public boolean isProjectInTrash(long projectId) { + Project project = projectsMap.get(projectId); + return project != null && project.isInTrash(); + } }