Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Added test for nil in Roo::Excelx#read_hyperlinks to avoid error "NoM…
…ethodError (undefined method `text' for nil:NilClass)"
  • Loading branch information
rui-castro committed Mar 27, 2014
1 parent 56e2e61 commit 75bc50a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
@@ -1,3 +1,4 @@
/pkg/
/log/
.ruby-version
.project
2 changes: 1 addition & 1 deletion lib/roo/excelx.rb
Expand Up @@ -539,7 +539,7 @@ def read_hyperlinks(sheet=nil)
[r.attribute('Id').text, r]
end]
@sheet_doc[n].xpath("/xmlns:worksheet/xmlns:hyperlinks/xmlns:hyperlink").each do |h|
if rel_element = rels[h.attribute('id').text]
if h.attribute('id') && rel_element = rels[h.attribute('id').text]
row,col = Roo::Base.split_coordinate(h.attributes['ref'].to_s)
@hyperlink[sheet] ||= {}
@hyperlink[sheet][[row,col]] = rel_element.attribute('Target').text
Expand Down

0 comments on commit 75bc50a

Please sign in to comment.