Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(Tumblr) Add nil check to prevent undefined method error (fixes #29) #179

Merged
merged 4 commits into from
May 7, 2015
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions lib/jekyll-import/importers/tumblr.rb
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,10 @@ def self.post_to_hash(post, format)
when "video"
title = post["video-title"]
content = post["video-player"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If content is false, then it means something went wrong here.

unless post["video-caption"].nil?
content << "<br/>" + post["video-caption"]
unless post[:content].nil?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this check content?

unless content.nil? || post["video-caption"].nil?
  content << "<br/>" + post["video-caption"]
end

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, would you like me to make this change to the PR? Unfortunately, I would have no way to try it out though...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes please! :)

unless post["video-caption"].nil?
content << "<br/>" + post["video-caption"]
end
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if content is nil, should we say content = post["video-caption"]?

when "answer"
title = post["question"]
Expand Down