From 4ad74c5736b3b97bcb0d420a4dc1230cbd602eaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=87a=C4=9Ftay=20Fabry?= Date: Tue, 2 Sep 2025 10:28:08 +0200 Subject: [PATCH] allow AdsWrite for zero length buffer backport of https://github.com/Beckhoff/ADS/commit/8bee2f64b62724aa5313997d8e60d0c68c789da6 see https://github.com/Beckhoff/ADS/issues/264 --- AdsLib/AdsLib.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/AdsLib/AdsLib.cpp b/AdsLib/AdsLib.cpp index c60c7f97..aeee6ecc 100644 --- a/AdsLib/AdsLib.cpp +++ b/AdsLib/AdsLib.cpp @@ -217,7 +217,7 @@ long AdsSyncWriteReqEx(long port, const void* buffer) { ASSERT_PORT_AND_AMSADDR(port, pAddr); - if (!buffer) { + if (!buffer && bufferLength) { return ADSERR_CLIENT_INVALIDPARM; } @@ -332,3 +332,4 @@ long AdsSyncSetTimeoutEx(long port, uint32_t timeout) ASSERT_PORT(port); return GetRouter().SetTimeout((uint16_t)port, timeout); } +