Fix unintelligible error when importing empty file
IO#read returns nil for an empty file if given a length argument, which caused a stack trace when attempting to import a file instead of a useful error message.unstable
parent
9e7885857c
commit
9ab68ac935
|
@ -2797,6 +2797,9 @@ class DBManager
|
|||
::File.open(filename, 'rb') do |f|
|
||||
data = f.read(4)
|
||||
end
|
||||
if data.nil?
|
||||
raise DBImportError.new("Zero-length file")
|
||||
end
|
||||
|
||||
case data[0,4]
|
||||
when "PK\x03\x04"
|
||||
|
|
Loading…
Reference in New Issue