diff --git a/includes/class-gumlet.php b/includes/class-gumlet.php index 3a72972..4b1b64f 100644 --- a/includes/class-gumlet.php +++ b/includes/class-gumlet.php @@ -653,6 +653,11 @@ public function replace_srcset_in_source($matches,$content) { //write function to remove srcset for img and this function. @$doc->loadHTML($source_tag); $sourceTag = $doc->getElementsByTagName('source')[0]; + if (!$sourceTag) { + $this->logger->log("No source tag found in HTML"); + continue; + } + $src = $sourceTag->getAttribute('srcset'); $sourceTag->removeAttribute("srcset"); $sourceTag->setAttribute("data-srcset", $src);