lib/memolog.rb in memolog-0.4.0 vs lib/memolog.rb in memolog-0.4.1
- old
+ new
@@ -55,10 +55,10 @@
beginning = logdevs.last.string.length - config.log_size_limit
beginning = 0 if beginning.negative?
dump = logdevs.last.string.slice(beginning, config.log_size_limit).presence
- config.parse_json ? JSON.parse(dump) : dump
+ dump && config.parse_json ? JSON.parse(dump) : dump
rescue JSON::ParserError
dump
end
end