Don't allow invalid values for header/footer insertion point

This commit is contained in:
cketti 2012-03-27 20:41:43 +02:00
parent 4e21f049d3
commit 1266c3c73e

View file

@ -32,11 +32,20 @@ class InsertableHtmlContent implements Serializable {
}
public void setHeaderInsertionPoint(int headerInsertionPoint) {
this.headerInsertionPoint = headerInsertionPoint;
if (headerInsertionPoint < 0 || headerInsertionPoint > quotedContent.length()) {
this.headerInsertionPoint = 0;
} else {
this.headerInsertionPoint = headerInsertionPoint;
}
}
public void setFooterInsertionPoint(int footerInsertionPoint) {
this.footerInsertionPoint = footerInsertionPoint;
int len = quotedContent.length();
if (footerInsertionPoint < 0 || footerInsertionPoint > len) {
this.footerInsertionPoint = len;
} else {
this.footerInsertionPoint = footerInsertionPoint;
}
}
/**