Skip to content

Commit 74e7e57

Browse files
author
Aidan Lee
committed
Add a smart strings guard
1 parent 3dbceb9 commit 74e7e57

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

include/cpp/marshal/Marshal.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ inline cpp::marshal::View<char> cpp::marshal::Marshal::asCharView(const ::String
3535

3636
inline cpp::marshal::View<char16_t> cpp::marshal::Marshal::asWideCharView(const ::String& string)
3737
{
38+
#if defined(HX_SMART_STRINGS)
3839
if (null() == string)
3940
{
4041
hx::NullReference("string", false);
@@ -46,6 +47,9 @@ inline cpp::marshal::View<char16_t> cpp::marshal::Marshal::asWideCharView(const
4647
}
4748

4849
return View<char16_t>(const_cast<char16_t*>(string.raw_wptr()), string.length);
50+
#else
51+
return hx::Throw(HX_CSTRING("HX_SMART_STRINGS not defined"));
52+
#endif
4953
}
5054

5155
template<class T>

0 commit comments

Comments
 (0)