Skip to content

Commit

Permalink
fixes #1992 sort does not fail if vlanid is null
Browse files Browse the repository at this point in the history
  • Loading branch information
Joseph Mitchell Magen authored and ohadlevy committed Dec 24, 2012
1 parent e210844 commit 9f9effa
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/models/subnet.rb
Expand Up @@ -47,7 +47,11 @@ def title
# [+other+] : Subnet object with which to compare ourself
# +returns+ : Subnet object with higher precedence
def <=> (other)
self.vlanid <=> other.vlanid
if self.vlanid.present? && other.vlanid.present?
self.vlanid <=> other.vlanid
else
return -1
end
end

# Given an IP returns the subnet that contains that IP
Expand Down

0 comments on commit 9f9effa

Please sign in to comment.