Permalink
Browse files

avoid error when analysing dynamic PO files (which doesn't contain bl…

…oginfo tags)
  • Loading branch information...
1 parent 4827e49 commit 1593e77cb2f9e74b6be451757229bacf55e85dc7 @vdepizzol committed Mar 10, 2012
Showing with 12 additions and 10 deletions.
  1. +12 −10 backend.php
View
@@ -230,16 +230,18 @@ function wppo_check_for_po_changes($force = false, $coverage = array('dynamic',
*/
$bloginfo = $dom->getElementsByTagName('bloginfo');
- foreach ($bloginfo->item(0)->childNodes as $option) {
- if (get_class($option) == 'DOMElement') {
- $option_node['option_name'] = $option->nodeName;
- $option_node['lang'] = $lang;
- $option_node['translated_value'] = $option->nodeValue;
-
- if (!$wpdb->get_row("SELECT option_name FROM ".WPPO_PREFIX."options WHERE option_name = '". mysql_real_escape_string($option_node['option_name']) ."' AND lang = '". mysql_real_escape_string($lang) ."'")) {
- $wpdb->insert(WPPO_PREFIX."options", $option_node);
- } else {
- $wpdb->update(WPPO_PREFIX."options", $option_node, array('option_name' => $option_node['options_name'], 'lang' => $lang));
+ if ($bloginfo->item(0) != null) {
+ foreach ($bloginfo->item(0)->childNodes as $option) {
+ if (get_class($option) == 'DOMElement') {
+ $option_node['option_name'] = $option->nodeName;
+ $option_node['lang'] = $lang;
+ $option_node['translated_value'] = $option->nodeValue;
+
+ if (!$wpdb->get_row("SELECT option_name FROM ".WPPO_PREFIX."options WHERE option_name = '". mysql_real_escape_string($option_node['option_name']) ."' AND lang = '". mysql_real_escape_string($lang) ."'")) {
+ $wpdb->insert(WPPO_PREFIX."options", $option_node);
+ } else {
+ $wpdb->update(WPPO_PREFIX."options", $option_node, array('option_name' => $option_node['options_name'], 'lang' => $lang));
+ }
}
}
}

0 comments on commit 1593e77

Please sign in to comment.