Skip to content

Commit

Permalink
Fix error when no match for view/section
Browse files Browse the repository at this point in the history
- FIXED: Error thrown when trying to guess a section/view when there's no match.
  • Loading branch information
ttscoff committed Mar 26, 2024
1 parent 1b6b6db commit 330d6ab
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/doing/wwid/guess.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ def guess_section(frag, guessed: false, suggest: false)

section = found ? found.title : nil

if suggest
Doing.logger.debug('Match:', %(Assuming "#{sect.title}" from "#{frag}"))
if section && suggest
Doing.logger.debug('Match:', %(Assuming "#{section}" from "#{frag}"))
return section
end

Expand All @@ -53,7 +53,7 @@ def guess_section(frag, guessed: false, suggest: false)

raise Errors::InvalidSection.new("unknown section #{frag.bold.white}", topic: 'Missing:')
end
section ? section.cap_first : guessed
section ? section.cap_first : nil
end

##
Expand Down

0 comments on commit 330d6ab

Please sign in to comment.