diff --git a/src/Dev/CliDebugView.php b/src/Dev/CliDebugView.php
index <HASH>..<HASH> 100644
--- a/src/Dev/CliDebugView.php
+++ b/src/Dev/CliDebugView.php
@@ -160,7 +160,7 @@ class CliDebugView extends DebugView
     public function debugVariableText($val)
     {
         // Check debug
-        if (ClassInfo::hasMethod($val, 'debug')) {
+        if (is_object($val) && ClassInfo::hasMethod($val, 'debug')) {
             return $val->debug();
         }
 
diff --git a/tests/php/Dev/CLIDebugViewTest.php b/tests/php/Dev/CLIDebugViewTest.php
index <HASH>..<HASH> 100644
--- a/tests/php/Dev/CLIDebugViewTest.php
+++ b/tests/php/Dev/CLIDebugViewTest.php
@@ -61,5 +61,16 @@ EOS
             ,
             $view->debugVariable(new ObjectWithDebug(), $this->caller)
         );
+
+        $this->assertEquals(
+            <<<EOS
+Debug (CLIDebugViewTest.php:17 - SilverStripe\\Dev\\Tests\\CLIDebugViewTest::setUp())
+SilverStripe\\Dev\\Tests\\DebugViewTest\\ObjectWithDebug
+
+
+EOS
+            ,
+            $view->debugVariable(ObjectWithDebug::class, $this->caller)
+        );
     }
 }
BUG Fix issue with CLIDebugView failing on class name of existing class
Fixes #<I>