Brought the branch in sync with rev. 1560225 of trunk


git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/batik/branches/custom-FontFamilyResolver@1562793 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/sources/org/apache/batik/transcoder/wmf/tosvg/AbstractWMFPainter.java b/sources/org/apache/batik/transcoder/wmf/tosvg/AbstractWMFPainter.java
index b22f4c8..7d57c66 100644
--- a/sources/org/apache/batik/transcoder/wmf/tosvg/AbstractWMFPainter.java
+++ b/sources/org/apache/batik/transcoder/wmf/tosvg/AbstractWMFPainter.java
@@ -156,7 +156,7 @@
              * to overall size, else we will go after the end of the byte array...
              */
             _size = bit.length - offset;
-            int pad = (_size / _height) - _width;            
+            int pad = (_size / _height) - _width;
             for (int j = 0; j < _height; j++) {
                 for (int i = 0; i < _width; i++) {
                     bitI[_width*(_height-j-1)+i] = palette [((int)bit[offset] & 0x00ff)];
@@ -178,7 +178,7 @@
                 offset += 4;
             }
 
-            // populate the int array : each pixel correspond to a bit in the byte array
+            // populate the int array : each pixel corresponds to a bit in the byte array
             int pos = 7;
             byte currentByte = bit[offset];
             // padded to long words
@@ -191,7 +191,8 @@
                     if (pos == -1) {
                         pos = 7;
                         offset++;
-                        currentByte = bit[offset];
+                        if (offset < bit.length)
+                            currentByte = bit[offset];
                     }
                 }
                 offset +=pad;