diff --git a/sw/qa/core/data/html/pass/fdo87601-1.html b/sw/qa/core/data/html/pass/fdo87601-1.html
new file mode 100644
index 000000000000..b33f11c1b0a7
--- /dev/null
+++ b/sw/qa/core/data/html/pass/fdo87601-1.html
@@ -0,0 +1,100 @@
+
+
+
+
+
+
+
+
+ Print
+ 100
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ x |
+ x |
+
+
+ x |
+ x |
+
+
+ x |
+ x |
+
+
+ x |
+ x |
+
+
+
+
+ | | |
+
+ x |
+ x |
+ x |
+
+ x | x | x |
+x | x | x |
+x | x | x |
+
+
+
diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx
index d2c6212dc8ac..138a64b71ef8 100644
--- a/sw/source/filter/html/swhtml.cxx
+++ b/sw/source/filter/html/swhtml.cxx
@@ -3074,7 +3074,7 @@ void SwHTMLParser::EndAttr( _HTMLAttr* pAttr, _HTMLAttr **ppDepAttr,
rText, pAttr->GetSttCnt() );
sal_Int32 nScriptEnd = g_pBreakIt->GetBreakIter()
->endOfScript( rText, pAttr->GetSttCnt(), nScriptTxt );
- while( nScriptEnd < nEndCnt )
+ while (nScriptEnd < nEndCnt && nScriptEnd != -1)
{
if( nScriptItem == nScriptTxt )
{