From d2a06893015a9e2845f9278af9e2ba15f9b37d9d Mon Sep 17 00:00:00 2001 From: Jan Breuer <jan.breuer@jaybee.cz> Date: 周一, 31 8月 2015 17:35:32 +0800 Subject: [PATCH] Fix #44: incorrect handling of empty string --- examples/common/scpi-def.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/common/scpi-def.c b/examples/common/scpi-def.c index 4e690b8..da8e847 100644 --- a/examples/common/scpi-def.c +++ b/examples/common/scpi-def.c @@ -170,8 +170,9 @@ char buffer[100]; size_t copy_len; - SCPI_ParamCopyText(context, buffer, sizeof(buffer), ©_len, FALSE); - buffer[copy_len] = '\0'; + if (!SCPI_ParamCopyText(context, buffer, sizeof(buffer), ©_len, FALSE)) { + buffer[0] = '\0'; + } fprintf(stderr, "TEXT: ***%s***\r\n", buffer); -- Gitblit v1.9.1