From c0250e16e3c153089f1a48bfec90ff65519f6883 Mon Sep 17 00:00:00 2001
From: Jonas Jenwald <jonas.jenwald@gmail.com>
Date: Thu, 12 Jun 2014 12:46:39 +0200
Subject: [PATCH] Return ErrorFont in loadFont when the fontRef is undefined

---
 src/core/evaluator.js | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/core/evaluator.js b/src/core/evaluator.js
index cd57e193e..7ce1e3999 100644
--- a/src/core/evaluator.js
+++ b/src/core/evaluator.js
@@ -469,6 +469,11 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
           return errorFont();
         }
       }
+      if (!fontRef) {
+        warn('fontRef not available');
+        return errorFont();
+      }
+
       if (this.fontCache.has(fontRef)) {
         return this.fontCache.get(fontRef);
       }