mirror of
https://github.com/kusti8/proton-native.git
synced 2026-05-15 14:15:50 -06:00
Existence guard containerProps.children (#257)
Prevents a `Cannot read property 'children' of undefined` error if using an element not yet defined, therefore allows the `Element is not defined` error to actually throw.
This commit is contained in:
parent
125869ce79
commit
0722b3c2c8
1 changed files with 11 additions and 7 deletions
|
|
@ -24,18 +24,22 @@ export default (props: {}) => {
|
|||
);
|
||||
|
||||
const quit = () => {
|
||||
for (let i = 0; i < containerProps.children[0].children.length; i++) {
|
||||
containerProps.children[0].children[i].element.close();
|
||||
if (containerProps.children && containerProps.children.length) {
|
||||
for (let i = 0; i < containerProps.children[0].children.length; i++) {
|
||||
containerProps.children[0].children[i].element.close();
|
||||
}
|
||||
}
|
||||
disconnectDevtools();
|
||||
};
|
||||
|
||||
const interval = setInterval(() => {
|
||||
for (let i = 0; i < containerProps.children[0].children.length; i++) {
|
||||
const closed = containerProps.children[0].children[i].element.getClosed();
|
||||
if (!closed) {
|
||||
element.runLoop();
|
||||
return;
|
||||
if (containerProps.children && containerProps.children.length) {
|
||||
for (let i = 0; i < containerProps.children[0].children.length; i++) {
|
||||
const closed = containerProps.children[0].children[i].element.getClosed();
|
||||
if (!closed) {
|
||||
element.runLoop();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
quit();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue