Fixes crash for bad property of PackedScene
This commit is contained in:
parent
7f56ef3658
commit
4b660a87d8
|
@ -1097,6 +1097,14 @@ void SceneState::set_bundled_scene(const Dictionary &p_dictionary) {
|
||||||
|
|
||||||
ERR_FAIL_COND_MSG(version > PACK_VERSION, "Save format version too new.");
|
ERR_FAIL_COND_MSG(version > PACK_VERSION, "Save format version too new.");
|
||||||
|
|
||||||
|
const int node_count = p_dictionary["node_count"];
|
||||||
|
const PoolVector<int> snodes = p_dictionary["nodes"];
|
||||||
|
ERR_FAIL_COND(snodes.size() != node_count);
|
||||||
|
|
||||||
|
const int conn_count = p_dictionary["conn_count"];
|
||||||
|
const PoolVector<int> sconns = p_dictionary["conns"];
|
||||||
|
ERR_FAIL_COND(sconns.size() != conn_count);
|
||||||
|
|
||||||
PoolVector<String> snames = p_dictionary["names"];
|
PoolVector<String> snames = p_dictionary["names"];
|
||||||
if (snames.size()) {
|
if (snames.size()) {
|
||||||
|
|
||||||
|
@ -1121,13 +1129,11 @@ void SceneState::set_bundled_scene(const Dictionary &p_dictionary) {
|
||||||
variants.clear();
|
variants.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
nodes.resize(p_dictionary["node_count"]);
|
nodes.resize(node_count);
|
||||||
int nc = nodes.size();
|
if (node_count) {
|
||||||
if (nc) {
|
|
||||||
PoolVector<int> snodes = p_dictionary["nodes"];
|
|
||||||
PoolVector<int>::Read r = snodes.read();
|
PoolVector<int>::Read r = snodes.read();
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
for (int i = 0; i < nc; i++) {
|
for (int i = 0; i < node_count; i++) {
|
||||||
NodeData &nd = nodes.write[i];
|
NodeData &nd = nodes.write[i];
|
||||||
nd.parent = r[idx++];
|
nd.parent = r[idx++];
|
||||||
nd.owner = r[idx++];
|
nd.owner = r[idx++];
|
||||||
|
@ -1151,15 +1157,11 @@ void SceneState::set_bundled_scene(const Dictionary &p_dictionary) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
connections.resize(p_dictionary["conn_count"]);
|
connections.resize(conn_count);
|
||||||
int cc = connections.size();
|
if (conn_count) {
|
||||||
|
|
||||||
if (cc) {
|
|
||||||
|
|
||||||
PoolVector<int> sconns = p_dictionary["conns"];
|
|
||||||
PoolVector<int>::Read r = sconns.read();
|
PoolVector<int>::Read r = sconns.read();
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
for (int i = 0; i < cc; i++) {
|
for (int i = 0; i < conn_count; i++) {
|
||||||
ConnectionData &cd = connections.write[i];
|
ConnectionData &cd = connections.write[i];
|
||||||
cd.from = r[idx++];
|
cd.from = r[idx++];
|
||||||
cd.to = r[idx++];
|
cd.to = r[idx++];
|
||||||
|
|
Loading…
Reference in New Issue