lib/raven/linecache.rb in sentry-raven-0.13.3 vs lib/raven/linecache.rb in sentry-raven-0.14.0
- old
+ new
@@ -3,20 +3,27 @@
module Raven
class LineCache
class << self
CACHE = {}
+ def is_valid_file(path)
+ lines = getlines(path)
+ return lines != nil
+ end
+
def getlines(path)
CACHE[path] ||= begin
IO.readlines(path)
rescue
- []
+ nil
end
end
def getline(path, n)
return nil if n < 1
- getlines(path)[n - 1]
+ lines = getlines(path)
+ return nil if lines == nil
+ lines[n - 1]
end
end
end
end