diff options
-rw-r--r-- | modules/system/system.install | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/modules/system/system.install b/modules/system/system.install index 993e4bd1f..c0bd24b47 100644 --- a/modules/system/system.install +++ b/modules/system/system.install @@ -2342,14 +2342,17 @@ function system_update_164() { $result = db_query('SELECT nid, polled FROM {poll}'); while ($poll = db_fetch_object($result)) { - foreach (explode(' ', $poll->polled) as $polled) { - if ($polled[0] == '_') { - // $polled is a user id - db_query('INSERT INTO {poll_votes} (nid, uid) VALUES (%d, %d)', $poll->nid, substr($polled, 1, -1)); - } - else { - // $polled is a host - db_query("INSERT INTO {poll_votes} (nid, hostname) VALUES (%d, '%s')", $poll->nid, $polled); + if (!empty($poll->polled)) { + foreach (explode(' ', $poll->polled) as $polled) { + if ($polled[0] == '_') { + // $polled is a user id + db_query('INSERT INTO {poll_votes} (nid, uid) VALUES (%d, %d)', $poll->nid, substr($polled, +1, -1)); + } + else { + // $polled is a host + db_query("INSERT INTO {poll_votes} (nid, hostname) VALUES (%d, '%s')", $poll->nid, $polled); + } } } } |