summaryrefslogtreecommitdiffstats
path: root/vespajlib
diff options
context:
space:
mode:
authorLester Solbakken <lesters@oath.com>2021-04-29 08:43:32 +0200
committerLester Solbakken <lesters@oath.com>2021-04-29 08:43:32 +0200
commit993a656985977b0507e21e630c43158d601c9d14 (patch)
tree5cd940d6e214195ecab1b2309baa9efca38ff52e /vespajlib
parent4a7cf7e9b02062780a0ea88739974ffdfb999e4a (diff)
Java mixed tensor: don't throw out of bounds exception
Diffstat (limited to 'vespajlib')
-rw-r--r--vespajlib/src/main/java/com/yahoo/tensor/MixedTensor.java2
1 files changed, 1 insertions, 1 deletions
diff --git a/vespajlib/src/main/java/com/yahoo/tensor/MixedTensor.java b/vespajlib/src/main/java/com/yahoo/tensor/MixedTensor.java
index 606509bbfd8..7631a2e4eab 100644
--- a/vespajlib/src/main/java/com/yahoo/tensor/MixedTensor.java
+++ b/vespajlib/src/main/java/com/yahoo/tensor/MixedTensor.java
@@ -53,7 +53,7 @@ public class MixedTensor implements Tensor {
@Override
public double get(TensorAddress address) {
long cellIndex = index.indexOf(address);
- if (cellIndex < 0)
+ if (cellIndex < 0 || cellIndex >= cells.size())
return Double.NaN;
Cell cell = cells.get((int)cellIndex);
if ( ! address.equals(cell.getKey()))