Skip to content

Commit

Permalink
Don't assume there are existing policies.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrubinsk committed Jul 25, 2016
1 parent 379dded commit 477e7d3
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions sam/lib/Driver/Amavisd/Sql.php
Expand Up @@ -79,17 +79,18 @@ public function retrieve()
$userID = $this->_lookupUserID();

/* Find the policy id. */
$policyID = $this->_lookupPolicyID();
if ($policyID = $this->_lookupPolicyID()) {

/* Query for SPAM policy. */
try {
$result = $this->_db->selectOne(
sprintf('SELECT * FROM %s WHERE %s = ?',
$this->_mapNameToTable('policies'),
$this->_mapAttributeToField('policies', 'id')),
array($policyID));
} catch (Horde_Db_Exception $e) {
throw new Sam_Exception($e);
/* Query for SPAM policy. */
try {
$result = $this->_db->selectOne(
sprintf('SELECT * FROM %s WHERE %s = ?',
$this->_mapNameToTable('policies'),
$this->_mapAttributeToField('policies', 'id')),
array($policyID));
} catch (Horde_Db_Exception $e) {
throw new Sam_Exception($e);
}
}

/* Loop through elements of the result, retrieving options. */
Expand Down

0 comments on commit 477e7d3

Please sign in to comment.