diff --git a/HtmlDiff.php b/HtmlDiff.php
index 15dc7d0..ccd50ea 100644
--- a/HtmlDiff.php
+++ b/HtmlDiff.php
@@ -263,7 +263,7 @@ private function InsertTag( $tag, $cssClass, &$words ) {
}
}
}
- if( count( $words ) == 0 && count( $specialCaseTagInjection ) == 0 ) {
+ if( count( $words ) == 0 && !empty( $specialCaseTagInjection ) ) {
break;
}
if( $specialCaseTagInjectionIsBefore ) {
@@ -357,7 +357,7 @@ private function Operations() {
if( $action != 'none' ) {
$operations[] = new Operation( $action, $positionInOld, $match->StartInOld, $positionInNew, $match->StartInNew );
}
- if( count( $match ) != 0 ) {
+ if( isset( $match ) ) {
$operations[] = new Operation( 'equal', $match->StartInOld, $match->EndInOld(), $match->StartInNew, $match->EndInNew() );
}
$positionInOld = $match->EndInOld();