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.cpp | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/common/scpi-def.cpp b/examples/common/scpi-def.cpp index d3b737c..c69af2e 100644 --- a/examples/common/scpi-def.cpp +++ b/examples/common/scpi-def.cpp @@ -167,8 +167,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