summaryrefslogtreecommitdiff
path: root/src/library/scala/runtime/AbstractPartialFunction.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2012-01-08 19:36:33 -0800
committerPaul Phillips <paulp@improving.org>2012-01-08 19:57:49 -0800
commitaf4a5299290090ff433f2ad7bb801bf4226f423f (patch)
treecff3ece068ac1eb90e29976ebc9d28cdb603473a /src/library/scala/runtime/AbstractPartialFunction.scala
parent1684baefd23a806dbbec7e8f536ac3d624702886 (diff)
downloadscala-af4a5299290090ff433f2ad7bb801bf4226f423f.tar.gz
scala-af4a5299290090ff433f2ad7bb801bf4226f423f.tar.bz2
scala-af4a5299290090ff433f2ad7bb801bf4226f423f.zip
Fix for PartialFunction NPE.
Was going straight to the field and bypassing the null guard. Closes SI-5300.
Diffstat (limited to 'src/library/scala/runtime/AbstractPartialFunction.scala')
-rw-r--r--src/library/scala/runtime/AbstractPartialFunction.scala4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/library/scala/runtime/AbstractPartialFunction.scala b/src/library/scala/runtime/AbstractPartialFunction.scala
index f48d99f5af..cbe778f09b 100644
--- a/src/library/scala/runtime/AbstractPartialFunction.scala
+++ b/src/library/scala/runtime/AbstractPartialFunction.scala
@@ -26,7 +26,7 @@ abstract class AbstractPartialFunction[-T1, +R]
private var fallBackField: PartialFunction[T1 @uncheckedVariance, R @uncheckedVariance] = _
def fallBack: PartialFunction[T1, R] = synchronized {
- if (fallBackField == null) fallBackField = PartialFunction.empty
+ if (fallBackField eq null) fallBackField = PartialFunction.empty
fallBackField
}
@@ -38,7 +38,7 @@ abstract class AbstractPartialFunction[-T1, +R]
override def orElse[A1 <: T1, B1 >: R](that: PartialFunction[A1, B1]) : PartialFunction[A1, B1] = {
val result = this.clone.asInstanceOf[AbstractPartialFunction[A1, B1]]
result.synchronized {
- result.fallBackField = this.fallBackField orElse that
+ result.fallBackField = if (this.fallBackField eq null) that else this.fallBackField orElse that
result
}
}