diff --git a/src/infrastructure/markup/markuprule/PhutilRemarkupHexColorCodeRule.php b/src/infrastructure/markup/markuprule/PhutilRemarkupHexColorCodeRule.php
--- a/src/infrastructure/markup/markuprule/PhutilRemarkupHexColorCodeRule.php
+++ b/src/infrastructure/markup/markuprule/PhutilRemarkupHexColorCodeRule.php
@@ -9,10 +9,14 @@
 
   public function apply($text) {
     // Match {#FFFFFF}
-    return preg_replace_callback(
-      '@\B\{(#([0-9a-fA-F]{3}){1,2})\}@',
-      array($this, 'markupHexColorCodedText'),
-      $text);
+    if (is_string($text)) {
+      return preg_replace_callback(
+        '@\B\{(#([0-9a-fA-F]{3}){1,2})\}@',
+        array($this, 'markupHexColorCodedText'),
+        $text);
+    } else {
+      return $text;
+    }
   }
 
   protected function contrastingColor($color_code) {