diff options
author | PJ Fanning <fanningpj@apache.org> | 2024-05-17 10:00:28 +0000 |
---|---|---|
committer | PJ Fanning <fanningpj@apache.org> | 2024-05-17 10:00:28 +0000 |
commit | af5d4b9f220f9a9e54dc87dc1a032424511104cc (patch) | |
tree | a4339122d6fb9ec21b4ef5821fd4eb75821db9da /poi/src/main | |
parent | 48305903b362ae9dc4afcf20aa02ac2d3649f4df (diff) | |
download | poi-af5d4b9f220f9a9e54dc87dc1a032424511104cc.tar.gz poi-af5d4b9f220f9a9e54dc87dc1a032424511104cc.zip |
[bug-69021] add guard around cast
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1917779 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poi/src/main')
-rw-r--r-- | poi/src/main/java/org/apache/poi/hssf/model/InternalWorkbook.java | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/poi/src/main/java/org/apache/poi/hssf/model/InternalWorkbook.java b/poi/src/main/java/org/apache/poi/hssf/model/InternalWorkbook.java index a60fec9fd6..a536d74dd0 100644 --- a/poi/src/main/java/org/apache/poi/hssf/model/InternalWorkbook.java +++ b/poi/src/main/java/org/apache/poi/hssf/model/InternalWorkbook.java @@ -1071,13 +1071,16 @@ public final class InternalWorkbook { * * Include in it ant code that modifies the workbook record stream and affects its size. */ - public void preSerialize(){ + public void preSerialize() { // Ensure we have enough tab IDs // Can be a few short if new sheets were added - if(records.getTabpos() > 0) { - TabIdRecord tir = ( TabIdRecord ) records.get(records.getTabpos()); - if(tir.getTabIdSize() < boundsheets.size()) { - fixTabIdRecord(); + if (records.getTabpos() > 0) { + Record rec = records.get(records.getTabpos()); + if (rec instanceof TabIdRecord) { + TabIdRecord tir = ( TabIdRecord ) rec; + if(tir.getTabIdSize() < boundsheets.size()) { + fixTabIdRecord(); + } } } } |