From c31e4aebb8462eb466e57c866ebcc02ea9b9fa9a Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Tue, 3 Feb 2015 13:06:04 +0000 Subject: [PATCH] handled a corner case of no author in the code history --- codepot/src/codepot/controllers/code.php | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/codepot/src/codepot/controllers/code.php b/codepot/src/codepot/controllers/code.php index 03bec00e..5480b522 100644 --- a/codepot/src/codepot/controllers/code.php +++ b/codepot/src/codepot/controllers/code.php @@ -654,10 +654,14 @@ class Code extends Controller for ($i = 0; $i < $history_count; $i++) { $h = $history[$i]; - if (array_key_exists ($h['author'], $stats)) - $stats[$h['author']]++; - else - $stats[$h['author']] = 1; + if (array_key_exists ('author', $h)) + { + $author = $h['author']; + if (array_key_exists ($author, $stats)) + $stats[$author]++; + else + $stats[$author] = 1; + } } $this->load->library ('PHPGraphLibPie', array ('width' => 400, 'height' => 300), 'graph'); @@ -673,10 +677,14 @@ class Code extends Controller for ($i = 0; $i < $history_count; $i++) { $h = $history[$i]; - if (array_key_exists ($h['author'], $stats)) - $stats[$h['author']]++; - else - $stats[$h['author']] = 1; + if (array_key_exists ('author', $h)) + { + $author = $h['author']; + if (array_key_exists ($author, $stats)) + $stats[$author]++; + else + $stats[$author] = 1; + } } $this->load->library ('PHPGraphLib', array ('width' => 400, 'height' => 300), 'graph');