Fix get_server() in WebNode.

This commit is contained in:
Relintai 2022-07-21 22:31:48 +02:00
parent f7cc2df683
commit 1f62ad89ff

View File

@ -340,8 +340,19 @@ void WebNode::request_write_lock() {
}
WebServer *WebNode::get_server() {
// todo this shoult probably be cached
return Object::cast_to<WebServer>(get_tree());
Node *n = this;
while (n) {
WebServer *ws = Object::cast_to<WebServer>(n);
if (ws) {
return ws;
}
n = n->get_parent();
}
return nullptr;
}
WebNode *WebNode::get_web_root() {