diff --git a/submodules/WebUI/Sources/WebAppWebView.swift b/submodules/WebUI/Sources/WebAppWebView.swift index f1be891cc92..520f6860a57 100644 --- a/submodules/WebUI/Sources/WebAppWebView.swift +++ b/submodules/WebUI/Sources/WebAppWebView.swift @@ -227,7 +227,7 @@ final class WebAppWebView: WKWebView { } func sendEvent(name: String, data: String?) { - let script = "window.TelegramGameProxy.receiveEvent(\"\(name)\", \(data ?? "null"))" + let script = "window.TelegramGameProxy && window.TelegramGameProxy.receiveEvent && window.TelegramGameProxy.receiveEvent(\"\(name)\", \(data ?? "null"))" self.evaluateJavaScript(script, completionHandler: { _, _ in }) }