FP2-1575: Cherrypick http://bugs.icu-project.org/trac/change

Cherrypick http://bugs.icu-project.org/trac/changeset/37162.

Bug: http://b/19261635
Change-Id: I7c6b83cd9b651a9e9867134f1d62647beff8b1aa
diff --git a/icu4c/source/common/ubidi.c b/icu4c/source/common/ubidi.c
index 59f3fa5..cb783e9 100644
--- a/icu4c/source/common/ubidi.c
+++ b/icu4c/source/common/ubidi.c
@@ -2138,7 +2138,7 @@
     /* The isolates[] entries contain enough information to
        resume the bidi algorithm in the same state as it was
        when it was interrupted by an isolate sequence. */
-    if(dirProps[start]==PDI) {
+    if(dirProps[start]==PDI  && pBiDi->isolateCount >= 0) {
         levState.startON=pBiDi->isolates[pBiDi->isolateCount].startON;
         start1=pBiDi->isolates[pBiDi->isolateCount].start1;
         stateImp=pBiDi->isolates[pBiDi->isolateCount].stateImp;