From e4b4c508c599943ddb22b7d4868ccd40ac05a043 Mon Sep 17 00:00:00 2001
From: xj qian <qianxj15@sina.com>
Date: 星期四, 27 六月 2024 16:06:10 +0800
Subject: [PATCH] Merge branch 'master' of http://116.62.18.175:6699/r/mis-prj

---
 jrj/xframe/src/xstring.cpp |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/jrj/xframe/src/xstring.cpp b/jrj/xframe/src/xstring.cpp
index 23f1c2c..3bc27b1 100644
--- a/jrj/xframe/src/xstring.cpp
+++ b/jrj/xframe/src/xstring.cpp
@@ -284,8 +284,13 @@
 xstring& xstring::operator =(const xstring& rhs) 
 {
     if (data)((KStringBlock<wchar_t>*)data)->Release();
-    ((KStringBlock<wchar_t>*)rhs.data)->AddRef();
-    data = rhs.data;
+    if (rhs.data)
+    {
+        ((KStringBlock<wchar_t>*)rhs.data)->AddRef();
+        data = rhs.data;
+    }
+    else
+        data = nullptr;
    return *this;
 }
 xstring& xstring::operator =(const wchar_t* rhs)
@@ -590,7 +595,11 @@
     return false;
 }
 
-xstring xstring::replace(wchar_t* from, wchar_t* to, int pos)
+xstring xstring::replace(const wchar_t* from, const wchar_t* to)
+{
+    return replace(from, to, 0);
+}
+xstring xstring::replace(const wchar_t* from, const wchar_t* to, int pos)
 {
     const wchar_t* pstr = c_str();
     if (!pstr) return 0;

--
Gitblit v1.9.3