File tree Expand file tree Collapse file tree 1 file changed +18
-16
lines changed
Expand file tree Collapse file tree 1 file changed +18
-16
lines changed Original file line number Diff line number Diff line change @@ -1301,22 +1301,24 @@ void saveStringODS(OutputStream output, String text) throws IOException {
13011301 // save us from having to create the entire document in memory again before
13021302 // writing to the file. So while it's dorky, the outcome is still useful.
13031303 StringBuilder sanitized = new StringBuilder ();
1304- char [] array = text .toCharArray ();
1305- for (char c : array ) {
1306- if (c == '&' ) {
1307- sanitized .append ("&" );
1308- } else if (c == '\'' ) {
1309- sanitized .append ("'" );
1310- } else if (c == '"' ) {
1311- sanitized .append (""" );
1312- } else if (c == '<' ) {
1313- sanitized .append ("<" );
1314- } else if (c == '>' ) {
1315- sanitized .append ("&rt;" );
1316- } else if (c < 32 || c > 127 ) {
1317- sanitized .append ("&#" + ((int ) c ) + ";" );
1318- } else {
1319- sanitized .append (c );
1304+ if (text != null ) {
1305+ char [] array = text .toCharArray ();
1306+ for (char c : array ) {
1307+ if (c == '&' ) {
1308+ sanitized .append ("&" );
1309+ } else if (c == '\'' ) {
1310+ sanitized .append ("'" );
1311+ } else if (c == '"' ) {
1312+ sanitized .append (""" );
1313+ } else if (c == '<' ) {
1314+ sanitized .append ("<" );
1315+ } else if (c == '>' ) {
1316+ sanitized .append ("&rt;" );
1317+ } else if (c < 32 || c > 127 ) {
1318+ sanitized .append ("&#" + ((int ) c ) + ";" );
1319+ } else {
1320+ sanitized .append (c );
1321+ }
13201322 }
13211323 }
13221324
You can’t perform that action at this time.
0 commit comments