Skip to content

Commit 7c916e4

Browse files
author
Jason Smale
committed
Merge pull request #66 from ckrazoyo/razoyo/zendesk
Check if users before attempting to access
2 parents 86f1ae9 + adf858f commit 7c916e4

File tree

1 file changed

+16
-12
lines changed
  • src/app/code/community/Zendesk/Zendesk/Block/Adminhtml/Dashboard/Tab/Tickets/Grid/Renderer

1 file changed

+16
-12
lines changed

src/app/code/community/Zendesk/Zendesk/Block/Adminhtml/Dashboard/Tab/Tickets/Grid/Renderer/Email.php

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,24 @@
1919
class Zendesk_Zendesk_Block_Adminhtml_Dashboard_Tab_Tickets_Grid_Renderer_Email extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract {
2020

2121
public function render(Varien_Object $row) {
22-
$users = Mage::registry('zendesk_users') ? Mage::registry('zendesk_users') : array();
22+
$users = Mage::registry('zendesk_users');
2323
$value = (int) $row->getData($this->getColumn()->getIndex());
24-
25-
$found = array_filter($users, function($user) use($value) {
26-
return (int) $user['id'] === $value;
27-
});
28-
29-
if( count($found) ) {
24+
25+
if ($users) {
26+
$found = array_filter($users, function($user) use($value) {
27+
return (int) $user['id'] === $value;
28+
});
29+
} else {
30+
return '';
31+
}
32+
33+
if( count($found) ) {
3034
$user = array_shift($found);
31-
35+
3236
return $user['email'];
33-
}
34-
35-
return '';
36-
}
37+
}
38+
39+
return '';
40+
}
3741

3842
}

0 commit comments

Comments
 (0)