Skip to content

Commit

Permalink
Guard against NPE if CC is used outside of an application
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Or committed Apr 29, 2015
1 parent 3998168 commit e909a42
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,9 @@ private[spark] object ClosureCleaner extends Logging {

private def ensureSerializable(func: AnyRef) {
try {
SparkEnv.get.closureSerializer.newInstance().serialize(func)
if (SparkEnv.get != null) {
SparkEnv.get.closureSerializer.newInstance().serialize(func)
}
} catch {
case ex: Exception => throw new SparkException("Task not serializable", ex)
}
Expand Down

0 comments on commit e909a42

Please sign in to comment.