summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIulian Dragos <jaguarul@gmail.com>2009-01-21 15:41:10 +0000
committerIulian Dragos <jaguarul@gmail.com>2009-01-21 15:41:10 +0000
commitca805b9f21337a8fcb965432c709cddb7c00f1b9 (patch)
tree37270d2043954b7d6f23a9b2ce2371699220c30a /src
parent77852ce568332337a23b83b3dc911f2242373f1d (diff)
downloadscala-ca805b9f21337a8fcb965432c709cddb7c00f1b9.tar.gz
scala-ca805b9f21337a8fcb965432c709cddb7c00f1b9.tar.bz2
scala-ca805b9f21337a8fcb965432c709cddb7c00f1b9.zip
Fixed NPE when calling hashCode on a product co...
Fixed NPE when calling hashCode on a product containing nulls (#216)
Diffstat (limited to 'src')
-rw-r--r--src/library/scala/runtime/ScalaRunTime.scala3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/library/scala/runtime/ScalaRunTime.scala b/src/library/scala/runtime/ScalaRunTime.scala
index c98fd33c6a..bee37d44c1 100644
--- a/src/library/scala/runtime/ScalaRunTime.scala
+++ b/src/library/scala/runtime/ScalaRunTime.scala
@@ -86,7 +86,8 @@ object ScalaRunTime {
val arr = x.productArity
var i = 0
while (i < arr) {
- code = code * 41 + x.productElement(i).hashCode()
+ val elem = x.productElement(i)
+ code = code * 41 + (if (elem eq null) 0 else elem.hashCode())
i += 1
}
code