Skip to content

Commit

Permalink
#1588 Fixed customField integer from double
Browse files Browse the repository at this point in the history
  • Loading branch information
rriclet authored and To-om committed Nov 4, 2020
1 parent 3d1fe3d commit 1a06362
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions thehive/app/org/thp/thehive/models/CustomField.scala
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ object CustomFieldInteger extends CustomFieldType[Int] {
override def setValue[C <: CustomFieldValue[C]](customFieldValue: C, value: Option[Any]): Try[C] =
value.getOrElse(JsNull) match {
case v: Int => Success(customFieldValue.integerValue = Some(v))
case v: Double => Success(customFieldValue.integerValue = Some(v.toInt))
case JsNumber(n) => Success(customFieldValue.integerValue = Some(n.toInt))
case JsNull | null => Success(customFieldValue.integerValue = None)
case obj: JsObject =>
Expand Down

0 comments on commit 1a06362

Please sign in to comment.