diff --git a/application/models/rows/CourseCode.php b/application/models/rows/CourseCode.php
index 08ecfeee1a42bc505fd67290c2d4ec15f0471a8e..03fc6bd29d32e555e424bf3aa41923c0b5bee7cf 100644
--- a/application/models/rows/CourseCode.php
+++ b/application/models/rows/CourseCode.php
@@ -20,7 +20,7 @@ class CourseCode extends Nmc_Db_Table_Row
         $where = implode(' AND ', $where);
 
         $row = $this->_table->fetchRow($where, $order);
-        if($row->getPrimaryKey()) {
+        if($row instanceof Nmc_Db_Table_Row && $row->getPrimaryKey()) {
             return $row;
         }
 
@@ -30,7 +30,7 @@ class CourseCode extends Nmc_Db_Table_Row
         $where = implode(' AND ', $where);
 
         $row = $this->_table->fetchRow($where, $order);
-        if($row->getPrimaryKey()) {
+        if($row instanceof Nmc_Db_Table_Row && $row->getPrimaryKey()) {
             return $row;
         }
 
@@ -39,7 +39,7 @@ class CourseCode extends Nmc_Db_Table_Row
         $where = implode(' AND ', $where);
 
         $row = $this->_table->fetchRow($where, $order);
-        if($row->getPrimaryKey()) {
+        if($row instanceof Nmc_Db_Table_Row && $row->getPrimaryKey()) {
             return $row;
         }
 
@@ -75,7 +75,7 @@ class CourseCode extends Nmc_Db_Table_Row
         $where = implode(' AND ', $where);
 
         $row = $this->_table->fetchRow($where, $order);
-        if($row->getPrimaryKey()) {
+        if($row instanceof Nmc_Db_Table_Row && $row->getPrimaryKey()) {
             return $row;
         }
 
@@ -84,7 +84,7 @@ class CourseCode extends Nmc_Db_Table_Row
         $where = implode(' AND ', $where);
 
         $row = $this->_table->fetchRow($where, $order);
-        if($row->getPrimaryKey()) {
+        if($row instanceof Nmc_Db_Table_Row && $row->getPrimaryKey()) {
             return $row;
         }