Skip to content

Commit 1d4c6e9

Browse files
authored
Make numerical operators nil safe
1 parent 2adef6d commit 1d4c6e9

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/flagsmith/engine/segments/models.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ class Condition
3737

3838
MATCHING_FUNCTIONS = {
3939
EQUAL => ->(other_value, self_value) { other_value == self_value },
40-
GREATER_THAN => ->(other_value, self_value) { other_value > self_value },
41-
GREATER_THAN_INCLUSIVE => ->(other_value, self_value) { other_value >= self_value },
42-
LESS_THAN => ->(other_value, self_value) { other_value < self_value },
43-
LESS_THAN_INCLUSIVE => ->(other_value, self_value) { other_value <= self_value },
40+
GREATER_THAN => ->(other_value, self_value) { other_value && other_value > self_value },
41+
GREATER_THAN_INCLUSIVE => ->(other_value, self_value) { other_value && other_value >= self_value },
42+
LESS_THAN => ->(other_value, self_value) { other_value && other_value < self_value },
43+
LESS_THAN_INCLUSIVE => ->(other_value, self_value) { other_value && other_value <= self_value },
4444
NOT_EQUAL => ->(other_value, self_value) { other_value != self_value },
4545
CONTAINS => ->(other_value, self_value) { other_value&.include? self_value },
4646

0 commit comments

Comments
 (0)