From 09d0d6b4ffc44ad033e282a91366c31ca7860947 Mon Sep 17 00:00:00 2001 From: Marcelo Matus Date: Wed, 3 May 2006 22:31:23 +0000 Subject: [PATCH] fix empty std::string case, reported by Daniel Moore git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@9076 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Lib/typemaps/std_strings.swg | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Lib/typemaps/std_strings.swg b/Lib/typemaps/std_strings.swg index e9c23ba91..ae934c182 100644 --- a/Lib/typemaps/std_strings.swg +++ b/Lib/typemaps/std_strings.swg @@ -40,7 +40,11 @@ SWIG_AsPtr_dec(String)(SWIG_Object obj, String **val) SWIGINTERNINLINE SWIG_Object SWIG_From_dec(String)(const String& s) { - return SWIG_FromCharPtrAndSize(s.data(), s.size()); + if (s.size()) { + return SWIG_FromCharPtrAndSize(s.data(), s.size()); + } else { + return SWIG_FromCharPtrAndSize("", 1); + } } } %enddef