Commit 22aaf83

mo khan <mo@mokhan.ca>
2021-05-11 03:26:36
fix: check for nil
1 parent b3060b8
Changed files (1)
lib
spandx
lib/spandx/core/dependency.rb
@@ -33,8 +33,8 @@ module Spandx
         return 1 if other.nil?
 
         score = (name <=> other.name)
-        score = score.zero? ? (version <=> other&.version) : score
-        score.zero? ? (path.to_s <=> other&.path.to_s) : score
+        score = score&.zero? ? (version <=> other&.version) : score
+        score&.zero? ? (path.to_s <=> other&.path.to_s) : score
       end
 
       def hash