diff options
author | Austin Ziegler <austin@zieglers.ca> | 2013-04-11 10:57:14 -0700 |
---|---|---|
committer | Austin Ziegler <austin@zieglers.ca> | 2013-04-11 10:57:14 -0700 |
commit | 68e1a153d44a9e5a682144c2eb1a7800b5880480 (patch) | |
tree | 1eb87fcad1de6c7bd856b2daf869c9dc1d5f1e6c /lib/diff/lcs | |
parent | 498a97c9089ea377d85f03470ecef1c1a5c6330a (diff) | |
parent | c1373fd0c4e9e398d2f474376e99500ef882d856 (diff) | |
download | diff-lcs-68e1a153d44a9e5a682144c2eb1a7800b5880480.tar.gz |
Merge pull request #17 from JonRowe/guard_against_empty
Fix an issue caused by detecting the encoding when first data is empty
Diffstat (limited to 'lib/diff/lcs')
-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 |