Skip to content

Commit 1842307

Browse files
committed
Fix tab-completion crash.
1 parent b61980b commit 1842307

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

client_server/ComputeThread.cc

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -283,22 +283,30 @@ void ComputeThread::on_message(websocketpp::connection_hdl hdl, message_ptr msg)
283283
root=nlohmann::json::parse(msg->get_payload());
284284
}
285285
catch(nlohmann::json::exception& e) {
286-
std::cerr << "cadabra-client: cannot parse message" << std::endl;
286+
std::cerr << "cadabra-client: cannot parse message." << std::endl;
287+
return;
288+
}
289+
if(root.count("header")==0) {
290+
std::cerr << "cadabra-client: received message without 'header'." << std::endl;
291+
return;
292+
}
293+
if(root.count("content")==0) {
294+
std::cerr << "cadabra-client: received message without 'content'." << std::endl;
287295
return;
288296
}
289297
const nlohmann::json& header = root["header"];
290298
const nlohmann::json& content = root["content"];
291299
const std::string msg_type = root.value("msg_type", "");
292300

293301
DataCell::id_t parent_id;
294-
parent_id.id = header["parent_id"].get<uint64_t>();
302+
parent_id.id = header.value("parent_id", uint64_t(0));
295303
if(header.value("parent_origin", "")=="client")
296304
parent_id.created_by_client=true;
297305
else
298306
parent_id.created_by_client=false;
299307
DataCell::id_t cell_id;
300308
cell_id.id = header["cell_id"].get<uint64_t>();
301-
if(header["cell_origin"].get<std::string>()=="client")
309+
if(header.value("cell_origin", "")=="client")
302310
cell_id.created_by_client=true;
303311
else
304312
cell_id.created_by_client=false;

web2/cadabra2/source/download.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ <h2>Binary packages</h2>
4848
<div class="distronum"><a href="https://cadabra.science/packages/fedora28/">Fedora 28</a></div>
4949
<div class="distronum"><a href="https://cadabra.science/packages/fedora29/">Fedora 29</a></div>
5050
<div class="distronum"><a href="https://cadabra.science/packages/fedora32/">Fedora 32</a></div>
51+
<div class="distronum"><a href="https://cadabra.science/packages/fedora33/">Fedora 33</a></div>
5152
<div class="distrotxt">
5253
</div>
5354
</div>
@@ -58,7 +59,7 @@ <h2>Binary packages</h2>
5859
<div class="distronum"><a href="https://cadabra.science/packages/mint20/">Mint Ulyana 20</a></div>
5960
</div>
6061

61-
<div class="distrotype">
62+
<!-- <div class="distrotype">
6263
<img src="static/images/centoslogo.png"/>
6364
<div class="distronum"><a href="https://cadabra.science/packages/centos7/">CentOS 7</a></div>
6465
<div class="distrotxt">
@@ -78,7 +79,7 @@ <h2>Binary packages</h2>
7879
install python-pip; sudo pip install sympy</code>
7980
in order to enable component computations.
8081
</div>
81-
</div>
82+
</div> -->
8283

8384
<div class="distrotype">
8485
<img src="static/images/opensuse_logo.png"/>

0 commit comments

Comments
 (0)