throw exception when the maximum number of fonts was exceeded

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@592520 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Yegor Kozlov 2007-11-06 18:52:52 +00:00
parent 65f468498a
commit 44041860e3

View File

@ -802,6 +802,9 @@ public class HSSFWorkbook extends POIDocument
{ {
fontindex++; // THERE IS NO FOUR!! fontindex++; // THERE IS NO FOUR!!
} }
if(fontindex == Short.MAX_VALUE){
throw new IllegalArgumentException("Maximum number of fonts was exceeded");
}
HSSFFont retval = new HSSFFont(fontindex, font); HSSFFont retval = new HSSFFont(fontindex, font);
return retval; return retval;