如果密码为空 写一个字节 弥补String Copy的问题
This commit is contained in:
parent
6491bca78c
commit
c9711f2d93
|
@ -1010,6 +1010,7 @@ bool Esp8266::SetWiFi(const BinaryPair& args, Stream& result)
|
||||||
if (!args.Get("ssid", ssid)) return false;
|
if (!args.Get("ssid", ssid)) return false;
|
||||||
if (!args.Get("pass", pass)) // 获取失败 直接给0的长度
|
if (!args.Get("pass", pass)) // 获取失败 直接给0的长度
|
||||||
{
|
{
|
||||||
|
pass.Clear();
|
||||||
pass.SetLength(0);
|
pass.SetLength(0);
|
||||||
// return false;
|
// return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -109,7 +109,11 @@ bool ISocketHost::SaveConfig()
|
||||||
nc.Gateway = Gateway.Value;
|
nc.Gateway = Gateway.Value;
|
||||||
|
|
||||||
if(SSID) SSID->CopyTo(0, nc.SSID, ArrayLength(nc.SSID) - 1);
|
if(SSID) SSID->CopyTo(0, nc.SSID, ArrayLength(nc.SSID) - 1);
|
||||||
if(Pass) Pass->CopyTo(0, nc.Pass, ArrayLength(nc.Pass) - 1);
|
if (Pass)
|
||||||
|
{
|
||||||
|
Pass->CopyTo(0, nc.Pass, ArrayLength(nc.Pass) - 1);
|
||||||
|
if (Pass->Length() == 0)nc.Pass[0] = 0x00; // 如果密码为空 写一个字节 弥补String Copy的问题
|
||||||
|
}
|
||||||
|
|
||||||
Buffer bs(&nc, sizeof(nc));
|
Buffer bs(&nc, sizeof(nc));
|
||||||
return Config::Current->Set("NET", bs);
|
return Config::Current->Set("NET", bs);
|
||||||
|
|
Loading…
Reference in New Issue