commit 6ff8b7f43e1fc37aabd35fd9bb8b9019693492da
parent 67ea9f7be9dbbbb37c3bf52fa28149fa18bc2ab5
Author: Christophe Coustet <christophe.coustet@meso-star.com>
Date: Wed, 3 Mar 2021 14:34:01 +0100
Fix invalid memory access on log outputs
Diffstat:
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/src/sdis_scene_Xd.h b/src/sdis_scene_Xd.h
@@ -1129,13 +1129,22 @@ XD(scene_get_medium)
res = RES_BAD_OP;
goto error;
}
-
+
+#if DIM == 2
+ if(iprim > 10 && iprim > (size_t)((double)nprims * 0.05)) {
+ log_warn(scn->dev,
+ "%s: performance issue. Up to %lu primitives were tested to define the "
+ "current medium at {%g, %g}.\n",
+ FUNC_NAME, (unsigned long)iprim, SPLIT2(P));
+ }
+#else
if(iprim > 10 && iprim > (size_t)((double)nprims * 0.05)) {
log_warn(scn->dev,
"%s: performance issue. Up to %lu primitives were tested to define the "
"current medium at {%g, %g, %g}.\n",
FUNC_NAME, (unsigned long)iprim, SPLIT3(P));
}
+#endif
exit:
*out_medium = medium;
diff --git a/src/sdis_solve_probe_boundary_Xd.h b/src/sdis_solve_probe_boundary_Xd.h
@@ -413,8 +413,8 @@ XD(solve_probe_boundary_flux)
log_err(scn->dev,
"%s: Attempt to compute a flux at a %s-%s interface.\n",
FUNC_NAME,
- (fmd->type == SDIS_FLUID ? "fluid" : "solid"),
- (bmd->type == SDIS_FLUID ? "fluid" : "solid"));
+ (!fmd ? "undefined" : (fmd->type == SDIS_FLUID ? "fluid" : "solid")),
+ (!bmd ? "undefined" : (bmd->type == SDIS_FLUID ? "fluid" : "solid")));
res = RES_BAD_ARG;
goto error;
}