Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed bug that kept revisions to be loaded for the first time

  • Loading branch information...
commit f2efa51eed2e89b9385703d3d6df085c791a35ea 1 parent c19be7f
authored June 01, 2012
13  plugins-server/cloud9.ide.revisions/revisions.js
@@ -108,6 +108,10 @@ require("util").inherits(RevisionsPlugin, Plugin);
108 108
                             self.broadcastConfirmSave(message.path, revisionInfo.revision);
109 109
                             if (message.forceRevisionListResponse === true) {
110 110
                                 self.getAllRevisions(revisionInfo.absPath, function(err, revObj) {
  111
+                                    if (err) {
  112
+                                        return console.error(err);
  113
+                                    }
  114
+
111 115
                                     self.broadcastRevisions.call(self, revObj, user, {
112 116
                                         path: message.path
113 117
                                     });
@@ -117,7 +121,8 @@ require("util").inherits(RevisionsPlugin, Plugin);
117 121
                         else {
118 122
                             this.getRevisions(message.path, function(err, revObj) {
119 123
                                 if (err) {
120  
-                                    return console.error("There was a problem retrieving the revisions" + " for the file " + message.path + ":\n", err);
  124
+                                    return console.error("There was a problem retrieving revisions" +
  125
+                                        " for the file " + message.path + ":\n", err);
121 126
                                 }
122 127
                     
123 128
                                 self.broadcastRevisions.call(self, revObj, null, {
@@ -199,13 +204,14 @@ require("util").inherits(RevisionsPlugin, Plugin);
199 204
             var error;
200 205
             var lineCount = 0;
201 206
             var lines = data.toString().split("\n");
202  
-
203 207
             if (lines.length) {
204 208
                 Async.whilst(
205 209
                     function () {
206  
-                        return (lineCount < lines.length && error === null);
  210
+                        return lineCount < lines.length && !error;
207 211
                     },
208 212
                     function (next) {
  213
+                        var line = lines[lineCount];
  214
+                        if (line) {
209 215
                     try {
210 216
                             var revision = JSON.parse(lines[lineCount]);
211 217
                             revObj[revision.ts] = revision;
@@ -213,6 +219,7 @@ require("util").inherits(RevisionsPlugin, Plugin);
213 219
                     catch(e) {
214 220
                             error = e;
215 221
                     }
  222
+                        }
216 223
                         lineCount++;
217 224
                     next();
218 225
                 },

0 notes on commit f2efa51

Please sign in to comment.
Something went wrong with that request. Please try again.