From 413faec849584155b2eb19c9affe5269b6119603 Mon Sep 17 00:00:00 2001 From: Nick Fisher Date: Mon, 14 Jul 2025 11:50:52 +0800 Subject: [PATCH] fix: add nan/negative checks inside setLensProjection --- .../src/filament/src/implementation/ffi_camera.dart | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/thermion_dart/lib/src/filament/src/implementation/ffi_camera.dart b/thermion_dart/lib/src/filament/src/implementation/ffi_camera.dart index 0ac1d32e..5ccb975c 100644 --- a/thermion_dart/lib/src/filament/src/implementation/ffi_camera.dart +++ b/thermion_dart/lib/src/filament/src/implementation/ffi_camera.dart @@ -5,11 +5,10 @@ import '../../../utils/src/matrix.dart'; class FFICamera extends Camera> { final Pointer camera; - + @override Pointer getNativeHandle() { return camera; - } final FFIFilamentApp app; @@ -92,6 +91,16 @@ class FFICamera extends Camera> { double far = kFar, double aspect = 1.0, double focalLength = kFocalLength}) async { + if (near.isNaN || + far.isNaN || + aspect.isNaN || + focalLength.isNaN || + near.isNegative || + far.isNegative || + aspect.isNegative || + focalLength.isNegative) { + throw FormatException(); + } Camera_setLensProjection(camera, near, far, aspect, focalLength); }