From b44e1c7765e114837750e45dacd0ca7be6350df3 Mon Sep 17 00:00:00 2001 From: "byte[]" Date: Wed, 17 Mar 2021 18:06:04 -0400 Subject: [PATCH] cap integer range --- lib/philomena/search/helpers.ex | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/philomena/search/helpers.ex b/lib/philomena/search/helpers.ex index e6a95e11..33a8597b 100644 --- a/lib/philomena/search/helpers.ex +++ b/lib/philomena/search/helpers.ex @@ -17,7 +17,10 @@ defmodule Philomena.Search.Helpers do def to_int(term) do {int, _} = :string.to_integer(term) - int + case int in -2_147_483_648..2_147_483_647 do + true -> int + _false -> 0 + end end def range([center, deviation]) do