Commit 86215c0311074ce998b6e5f88651f86e3d5e7a1e
Handle empty revisions list
cel committed on 12/1/2019, 5:24:50 AMParent: 3e16d9e26cb2f5204c569b42349451a6900adeda
Files changed
bin.js | changed |
bin.js | ||
---|---|---|
@@ -305,15 +305,11 @@ | ||
305 | 305 … | if (!page) { |
306 | 306 … | console.trace(data.query.pages, pageInfo) |
307 | 307 … | return cb(new Error('Unable to find page')) |
308 | 308 … | } |
309 | - var revs = page.revisions | |
310 | - if (!revs) { | |
311 | - console.trace(page, pageInfo) | |
312 | - return cb(new Error('Unable to get revisions')) | |
313 | - } | |
314 | - console.log('Got ' + page.revisions.length + ' revisions') | |
315 | - cb(null, page.revisions) | |
309 … | + var revs = page.revisions || [] | |
310 … | + console.log('Got ' + revs.length + ' revisions') | |
311 … | + cb(null, revs) | |
316 | 312 … | }) |
317 | 313 … | }, |
318 | 314 … | pull.flatten(), |
319 | 315 … | |
@@ -427,8 +423,12 @@ | ||
427 | 423 … | if (dry) { |
428 | 424 … | console.log(JSON.stringify(drafts, 0, 2)) |
429 | 425 … | return sbot.close() |
430 | 426 … | } |
427 … | + if (!drafts.length) { | |
428 … | + console.log('No messages to publish.') | |
429 … | + return sbot.close() | |
430 … | + } | |
431 | 431 … | if (yes) return confirmed(true) |
432 | 432 … | var rl = readline.createInterface({ |
433 | 433 … | input: process.stdin, |
434 | 434 … | output: process.stdout |
Built with git-ssb-web