diff --git a/src/core/core.cpp b/src/core/core.cpp index 7ebcc39ed..05726542b 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -153,6 +153,10 @@ void Core::make_tox(QByteArray savedata) toxOptions.proxy_host = nullptr; toxOptions.proxy_port = 0; + toxOptions.savedata_type = (!savedata.isNull() ? TOX_SAVEDATA_TYPE_TOX_SAVE : TOX_SAVEDATA_TYPE_NONE); + toxOptions.savedata_data = (uint8_t*)savedata.data(); + toxOptions.savedata_length = savedata.size(); + if (proxyType != ProxyType::ptNone) { QString proxyAddr = Settings::getInstance().getProxyAddr(); @@ -181,7 +185,7 @@ void Core::make_tox(QByteArray savedata) } TOX_ERR_NEW tox_err; - tox = tox_new(&toxOptions, (uint8_t*)savedata.data(), savedata.size(), &tox_err); + tox = tox_new(&toxOptions, &tox_err); switch (tox_err) { @@ -191,7 +195,7 @@ void Core::make_tox(QByteArray savedata) if (enableIPv6) { toxOptions.ipv6_enabled = false; - tox = tox_new(&toxOptions, (uint8_t*)savedata.data(), savedata.size(), &tox_err); + tox = tox_new(&toxOptions, &tox_err); if (tox_err == TOX_ERR_NEW_OK) { qWarning() << "Core failed to start with IPv6, falling back to IPv4. LAN discovery may not work properly.";