diff --git a/editor/js/ui/projects/projectSettings.js b/editor/js/ui/projects/projectSettings.js index 263bee66e..0f9f009d9 100644 --- a/editor/js/ui/projects/projectSettings.js +++ b/editor/js/ui/projects/projectSettings.js @@ -1254,14 +1254,16 @@ RED.projects.settings = (function() { row.fadeOut(200,function() { remotesList.editableList('removeItem',entry); setTimeout(spinner.remove, 100); - activeProject.git.remotes = {}; - data.remotes.forEach(function(remote) { - var name = remote.name; - delete remote.name; - activeProject.git.remotes[name] = remote; - }); if (data.remotes.length === 0) { + delete activeProject.git.remotes; remotesList.editableList('addItem',emptyItem); + } else { + activeProject.git.remotes = {}; + data.remotes.forEach(function(remote) { + var name = remote.name; + delete remote.name; + activeProject.git.remotes[name] = remote; + }); } }); }, diff --git a/red/runtime/storage/localfilesystem/projects/Project.js b/red/runtime/storage/localfilesystem/projects/Project.js index f3def6d48..9f50d4768 100644 --- a/red/runtime/storage/localfilesystem/projects/Project.js +++ b/red/runtime/storage/localfilesystem/projects/Project.js @@ -179,15 +179,19 @@ Project.prototype.loadRemotes = function() { project.branches = {}; return project.status(); }).then(function() { - var allRemotes = Object.keys(project.remotes); - var match = ""; - if (project.branches.remote) { - allRemotes.forEach(function(remote) { - if (project.branches.remote.indexOf(remote) === 0 && match.length < remote.length) { - match = remote; - } - }); - project.currentRemote = project.parseRemoteBranch(project.branches.remote).remote; + if (project.remotes) { + var allRemotes = Object.keys(project.remotes); + var match = ""; + if (project.branches.remote) { + allRemotes.forEach(function(remote) { + if (project.branches.remote.indexOf(remote) === 0 && match.length < remote.length) { + match = remote; + } + }); + project.currentRemote = project.parseRemoteBranch(project.branches.remote).remote; + } + } else { + delete project.currentRemote; } }); }