From 55143feed46e54b6343fd8b97a60a1ebad6ed068 Mon Sep 17 00:00:00 2001 From: Effy Elden Date: Mon, 22 Feb 2016 23:12:25 +0800 Subject: [PATCH] Fixed bug where an empty corpus .json would cause archive command to fail --- lib/twitter_ebooks/archive.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/twitter_ebooks/archive.rb b/lib/twitter_ebooks/archive.rb index 4a7a872..d0776e3 100644 --- a/lib/twitter_ebooks/archive.rb +++ b/lib/twitter_ebooks/archive.rb @@ -49,7 +49,7 @@ module Ebooks @client = client || make_client - if File.exists?(@path) + if (File.exists?(@path) && !File.zero?(@path)) @filetext = File.read(@path, :encoding => 'utf-8') @tweets = JSON.parse(@filetext, symbolize_names: true) log "Currently #{@tweets.length} tweets for #{@username}"