Skip to content

Commit 232b7cd

Browse files
More precise downcast for .getProp
@smuir pointed out that the downcast inside the Option doesn't do any checking (beyond checking the Option, of course). It doesn't much matter here, since it's an Any (which we can't do any checking on, anyway), but if that ever changed, this could be a weird hole for bugs to hide in.
1 parent 3ad2289 commit 232b7cd

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/main/scala/com/comcast/xfinity/sirius/api/SiriusConfiguration.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,9 @@ class SiriusConfiguration {
319319
*
320320
* @return Some(value) if it exists, or None if not
321321
*/
322-
def getProp[T](name: String): Option[T] = conf.get(name).asInstanceOf[Option[T]]
322+
def getProp[T](name: String): Option[T] = conf.get(name).map {
323+
case value => value.asInstanceOf[T]
324+
}
323325

324326
/**
325327
* Get a property with a default fallback

0 commit comments

Comments
 (0)