aboutsummaryrefslogtreecommitdiffstats
path: root/src/node.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/node.c')
-rw-r--r--src/node.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/node.c b/src/node.c
index 7f6e9863..061903bc 100644
--- a/src/node.c
+++ b/src/node.c
@@ -211,6 +211,10 @@ SERD_API
SerdNode
serd_node_new_decimal(double d, unsigned frac_digits)
{
+ if (isnan(d) || isinf(d)) {
+ return SERD_NODE_NULL;
+ }
+
const double abs_d = fabs(d);
const unsigned int_digits = (unsigned)fmax(1.0, ceil(log10(abs_d + 1)));
char* buf = (char*)calloc(int_digits + frac_digits + 3, 1);