Fix issue #121
diff --git a/system/database/DB_result.php b/system/database/DB_result.php
index 690734b..334e08c 100644
--- a/system/database/DB_result.php
+++ b/system/database/DB_result.php
@@ -242,7 +242,7 @@
 		$result = $this->custom_result_object($type);
 		if (count($result) === 0)
 		{
-			return $result;
+			return NULL;
 		}
 
 		if ($n != $this->current_row && isset($result[$n]))
@@ -253,6 +253,8 @@
 		return $result[$this->current_row];
 	}
 
+	// --------------------------------------------------------------------
+
 	/**
 	 * Returns a single result row - object version
 	 *
@@ -263,7 +265,7 @@
 		$result = $this->result_object();
 		if (count($result) === 0)
 		{
-			return $result;
+			return NULL;
 		}
 
 		if ($n != $this->current_row && isset($result[$n]))
@@ -286,7 +288,7 @@
 		$result = $this->result_array();
 		if (count($result) === 0)
 		{
-			return $result;
+			return NULL;
 		}
 
 		if ($n != $this->current_row && isset($result[$n]))
@@ -307,7 +309,7 @@
 	public function first_row($type = 'object')
 	{
 		$result = $this->result($type);
-		return (count($result) === 0) ? $result : $result[0];
+		return (count($result) === 0) ? NULL : $result[0];
 	}
 
 	// --------------------------------------------------------------------
@@ -320,7 +322,7 @@
 	public function last_row($type = 'object')
 	{
 		$result = $this->result($type);
-		return (count($result) === 0) ? $result : $result[count($result) - 1];
+		return (count($result) === 0) ? NULL : $result[count($result) - 1];
 	}
 
 	// --------------------------------------------------------------------
@@ -335,7 +337,7 @@
 		$result = $this->result($type);
 		if (count($result) === 0)
 		{
-			return $result;
+			return NULL;
 		}
 
 		if (isset($result[$this->current_row + 1]))
@@ -358,7 +360,7 @@
 		$result = $this->result($type);
 		if (count($result) === 0)
 		{
-			return $result;
+			return NULL;
 		}
 
 		if (isset($result[$this->current_row - 1]))
diff --git a/system/database/drivers/oci8/oci8_result.php b/system/database/drivers/oci8/oci8_result.php
index 7b05e0a..6fb6c81 100644
--- a/system/database/drivers/oci8/oci8_result.php
+++ b/system/database/drivers/oci8/oci8_result.php
@@ -419,7 +419,7 @@
 				OR $n < $this->current_row)
 			{
 				// No such row exists
-				return array();
+				return NULL;
 			}
 
 			// Get the next row index that would actually need to be fetched
@@ -460,7 +460,7 @@
 				$this->num_rows = 0;
 			}
 
-			return array();
+			return NULL;
 		}
 
 		$this->current_row = $n;
@@ -507,7 +507,7 @@
 			return (object) $row;
 		}
 
-		return array();
+		return NULL;
 	}
 
 	// --------------------------------------------------------------------
@@ -539,19 +539,19 @@
 			}
 			else
 			{
-				return array();
+				return NULL;
 			}
 		}
 		elseif ( ! class_exists($class_name)) // No such class exists
 		{
-			return array();
+			return NULL;
 		}
 
 		$row = $this->row_array($n);
-		// An array would mean that the row doesn't exist
-		if (is_array($row))
+		// A non-array would mean that the row doesn't exist
+		if ( ! is_array($row))
 		{
-			return $row;
+			return NULL;
 		}
 
 		// Convert to the desired class and return
diff --git a/system/database/drivers/sqlite3/sqlite3_result.php b/system/database/drivers/sqlite3/sqlite3_result.php
index d83d6b2..946b365 100644
--- a/system/database/drivers/sqlite3/sqlite3_result.php
+++ b/system/database/drivers/sqlite3/sqlite3_result.php
@@ -386,7 +386,7 @@
 				OR count($this->result_array) > 0 OR $n < $this->current_row)
 			{
 				// No such row exists
-				return array();
+				return NULL;
 			}
 
 			// Get the next row index that would actually need to be fetched
@@ -427,7 +427,7 @@
 				$this->num_rows = 0;
 			}
 
-			return array();
+			return NULL;
 		}
 
 		$this->current_row = $n;
@@ -469,7 +469,7 @@
 			return (object) $row;
 		}
 
-		return array();
+		return NULL;
 	}
 
 	// --------------------------------------------------------------------
@@ -501,19 +501,19 @@
 			}
 			else
 			{
-				return array();
+				return NULL;
 			}
 		}
 		elseif ( ! class_exists($class_name)) // No such class exists
 		{
-			return array();
+			return NULL;
 		}
 
 		$row = $this->row_array($n);
-		// An array would mean that the row doesn't exist
-		if (is_array($row))
+		// A non-array would mean that the row doesn't exist
+		if ( ! is_array($row))
 		{
-			return $row;
+			return NULL;
 		}
 
 		// Convert to the desired class and return