if ($this->getResultInstance()->next()) {
// Entry found
$exists = true;
+
+ // Is the username set?
+ if ($this->getUserName() == "") {
+ // Get current entry
+ $currEntry = $this->getResultInstance()->current();
+
+ // Set the username
+ $this->setUserName($currEntry['username']);
+ } // END - if
} // END - if
// Return the status
*
* @param $fieldName Field name which we shall get
* @return $fieldValue Field value from the user
- * @todo Do we need to secure this here against missing results?
+ * @throws NullPointerException If the result instance is null
*/
public final function getField ($fieldName) {
// Default field value
$fieldValue = null;
+ // Get result instance
+ $resultInstance = $this->getResultInstance();
+
+ // Is this instance null?
+ if (is_null($resultInstance)) {
+ // Then the user instance is no longer valid (expired cookies?)
+ throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER);
+ } // END - if
+
// Get current array
- $fieldArray = $this->getResultInstance()->current();
+ $fieldArray = $resultInstance->current();
// Does the field exist?
if (isset($fieldArray[$fieldName])) {