diff options
author | Jon Rowe <hello@jonrowe.co.uk> | 2013-04-11 17:21:55 +1000 |
---|---|---|
committer | Jon Rowe <hello@jonrowe.co.uk> | 2013-04-11 17:26:07 +1000 |
commit | 81367e66224e9fd0af4752f67583460df6422369 (patch) | |
tree | 24e03106a1bb376629692d79ba4d419e4b390c3c /lib/diff | |
parent | 498a97c9089ea377d85f03470ecef1c1a5c6330a (diff) | |
download | diff-lcs-81367e66224e9fd0af4752f67583460df6422369.tar.gz |
protect against no data
Diffstat (limited to 'lib/diff')
-rw-r--r-- | lib/diff/lcs/hunk.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/diff/lcs/hunk.rb b/lib/diff/lcs/hunk.rb index 6c5ea6a..05c3fb6 100644 --- a/lib/diff/lcs/hunk.rb +++ b/lib/diff/lcs/hunk.rb @@ -12,7 +12,7 @@ class Diff::LCS::Hunk # At first, a hunk will have just one Block in it @blocks = [ Diff::LCS::Block.new(piece) ] if String.method_defined?(:encoding) - @preferred_data_encoding = data_old[0].encoding + @preferred_data_encoding = data_old.fetch(0, data_new.fetch(0,'') ).encoding end @data_old = data_old @data_new = data_new |