Skip to content

Commit

Permalink
Fixes primary category offset error
Browse files Browse the repository at this point in the history
Prevents PHP errors in front end templates when trying to return a
primary category if no categories are set for the entry in question.
  • Loading branch information
Nathan Pitman committed Aug 28, 2014
1 parent 60c38dc commit b5f28b4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion system/third_party/nf_categories_field/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
if ( ! defined('NF_CF_NAME'))
{
define('NF_CF_NAME', 'Categories Field');
define('NF_CF_VERSION', '1.0.7');
define('NF_CF_VERSION', '1.0.8');
define('NF_CF_DOCS', 'http://github.com/ninefour/categories_field.ft.ee_addon');
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ function replace_primary_category_id($data, $params = array(), $tagdata = FALSE)
// array_filter removes empty nodes, array_values re-indexes
$categories = array_values(array_filter(explode($settings['delimiter'], $data)));

if (substr( $categories[0], 0, 1 ) === "p") {
if ($categories AND substr( $categories[0], 0, 1 ) === "p") {
$primary_cat_id = ltrim($categories[0],'p');
}

Expand Down

0 comments on commit b5f28b4

Please sign in to comment.