# HG changeset patch # User David Eads # Date 1235070613 18000 # Node ID e6378dbabe456c62b36535b16ea7df8300cdf0de # Parent ea5d7834d0dc23a75281affb376a80a09682e9c3 Added conditional logic to prevent choking on missing json data. diff -r ea5d7834d0dc -r e6378dbabe45 dnd.module --- a/dnd.module Thu Feb 19 14:04:31 2009 -0500 +++ b/dnd.module Thu Feb 19 14:10:13 2009 -0500 @@ -120,7 +120,6 @@ if (!isset($url['scheme'])) { $settings['url'] = $base_url .'/'. $settings['url']; } - dpm($settings); $request = drupal_http_request($settings['url']); @@ -128,8 +127,10 @@ $json = json_decode(str_replace(array('\x3c', '\x3e', '\x26'), array("<", ">", "&"), $request->data), TRUE); // Generate an array of editor representations to add - foreach ($json['editor_representations'] as $editor_id=>$editor_item) { - $editor_representations[$editor_id] = filter_xss_admin($editor_item); + if (is_array($json['editor_representations'])) { + foreach ($json['editor_representations'] as $editor_id=>$editor_item) { + $editor_representations[$editor_id] = filter_xss_admin($editor_item); + } } // Store editor representations in Drupal setting