Skip to content

Commit

Permalink
Check if cur-tag exists before using it
Browse files Browse the repository at this point in the history
So we don't feed nil into function that don't handle it. Also remove
unnecessary local variables.
  • Loading branch information
Tu Do authored and Tu Do committed Jul 26, 2015
1 parent 4adc464 commit ecd4071
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions srefactor.el
Original file line number Diff line number Diff line change
Expand Up @@ -1427,13 +1427,12 @@ tag and OPTIONS is a list of possible choices for each menu item.
"Check whether to add rename menu item."
(let* ((local-var (srefactor--tag-at-point))
(cur-tag (semantic-current-tag))
(cur-tag-start (semantic-tag-start cur-tag))
(tag-name (semantic-tag-name cur-tag))
(cur-tag-end (semantic-tag-end cur-tag)))
cur-tag-start cur-tag-end tag-name)
(when (and local-var
(eq (semantic-tag-class cur-tag) 'function)
(not (equal (car (semantic-ctxt-current-symbol)) tag-name))
(not (semantic-tag-prototype-p (semantic-current-tag)))
(not (equal (car (semantic-ctxt-current-symbol))
(semantic-tag-name cur-tag)))
(not (semantic-tag-prototype-p cur-tag))
(not (region-active-p)))
local-var)))

Expand Down

0 comments on commit ecd4071

Please sign in to comment.