Skip to content

Commit

Permalink
Casting a matrix<int> into matrix<float> wrongfully returned a field
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexisDrogoul committed Aug 3, 2021
1 parent 5ed78e8 commit 8bc1df1
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions msi.gama.core/src/msi/gaml/types/GamaMatrixType.java
Expand Up @@ -24,7 +24,6 @@
import msi.gama.runtime.exceptions.GamaRuntimeException;
import msi.gama.util.IContainer;
import msi.gama.util.IList;
import msi.gama.util.file.IFieldMatrixProvider;
import msi.gama.util.matrix.GamaFloatMatrix;
import msi.gama.util.matrix.GamaIntMatrix;
import msi.gama.util.matrix.GamaObjectMatrix;
Expand All @@ -50,8 +49,8 @@ public static IMatrix staticCast(final IScope scope, final Object obj, final Obj
final GamaPoint size = param instanceof GamaPoint ? (GamaPoint) param : null;

if (size == null) {
if (obj instanceof IFieldMatrixProvider && contentType.id() == IType.FLOAT)
return ((IFieldMatrixProvider) obj).getField(scope);
// if (obj instanceof IFieldMatrixProvider && contentType.id() == IType.FLOAT)
// return ((IFieldMatrixProvider) obj).getField(scope);
if (obj instanceof IContainer) return ((IContainer) obj).matrixValue(scope, contentType, copy);
return with(scope, obj, new GamaPoint(1, 1), contentType);
} else if (size.x <= 0 || size.y < 0)
Expand Down

0 comments on commit 8bc1df1

Please sign in to comment.