From 5f88feb2e58d7b4282d4f2f195c46c4961218aa2 Mon Sep 17 00:00:00 2001
From: Jared Hancock <jared@osticket.com>
Date: Mon, 28 Apr 2014 14:14:33 -0500
Subject: [PATCH] faq: Don't crash when adding with validation error

On validation errors, `$faq` will be set to something non-null, like
`false`, but will not be an instance of a Faq article.
---
 include/staff/faq.inc.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/staff/faq.inc.php b/include/staff/faq.inc.php
index 8f412bdb6..4db5f2c1d 100644
--- a/include/staff/faq.inc.php
+++ b/include/staff/faq.inc.php
@@ -90,7 +90,7 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info);
                 <textarea name="answer" cols="21" rows="12"
                     style="width:98%;" class="richtext draft"
                     data-draft-namespace="faq"
-                    data-draft-object-id="<?php if (isset($faq)) echo $faq->getId(); ?>"
+                    data-draft-object-id="<?php if (is_object($faq)) echo $faq->getId(); ?>"
                     ><?php echo $info['answer']; ?></textarea>
             </td>
         </tr>
-- 
GitLab