3
0
Fork 0
mirror of https://github.com/lubosz/overte.git synced 2025-04-26 23:15:31 +02:00

use fromUserInput in web entity URL set to avoid crashable URLs

This commit is contained in:
Stephen Birarda 2017-01-23 11:37:54 -08:00
parent 9605379265
commit 99e0c8c0e7

View file

@ -247,8 +247,15 @@ void RenderableWebEntityItem::render(RenderArgs* args) {
void RenderableWebEntityItem::setSourceUrl(const QString& value) {
if (_sourceUrl != value) {
qCDebug(entities) << "Setting web entity source URL to " << value;
_sourceUrl = value;
auto newURL = QUrl::fromUserInput(value);
if (newURL.isValid()) {
qCDebug(entities) << "Setting web entity source URL to " << value;
_sourceUrl = newURL.toDisplayString();
} else {
qCDebug(entities) << "Clearing web entity source URL since" << value << "cannot be parsed to a valid URL.";
}
if (_webSurface) {
AbstractViewStateInterface::instance()->postLambdaEvent([this] {
_webSurface->getRootItem()->setProperty("url", _sourceUrl);