fix: 修复V23环境下AM崩溃问题

修复V23环境下AM崩溃问题

Log:
Task: https://pms.uniontech.com/task-view-144473.html
Influence: AM正常运行
Change-Id: I07ee273d5105a51deb056821be315371312bdc16
This commit is contained in:
weizhixiang
2022-06-07 11:42:35 +08:00
parent a74c02d4c5
commit 290a45c6e8
7 changed files with 56 additions and 26 deletions

View File

@ -21,8 +21,6 @@
#include "dstring.h"
#include <assert.h>
DString::DString()
{
@ -35,9 +33,11 @@ DString::~DString()
std::vector<std::string> DString::splitChars(const char *cs, char c)
{
assert(cs);
std::vector<std::string> ret;
if (!cs) {
return ret;
}
unsigned long idx = 0;
unsigned long size = strlen(cs);
bool found = false;
@ -90,8 +90,9 @@ std::vector<std::string> DString::splitVectorChars(const std::vector<char> &cont
bool DString::startWith(const char *chars, const char *prefix)
{
assert(chars);
assert(prefix);
if (!chars || !prefix) {
return false;
}
size_t len;
len = strlen(prefix);
@ -105,8 +106,9 @@ bool DString::startWith(const std::string &str, const std::string &prefix)
bool DString::endWith(const char *chars, const char *suffix)
{
assert(chars);
assert(suffix);
if (!chars || !suffix) {
return false;
}
size_t charsLen = strlen(chars);
size_t suffixLen = strlen(suffix);