Skip to content
Snippets Groups Projects
Commit 24ef2830 authored by svornost's avatar svornost
Browse files

Don't crash FCHost when console.log is called from unknown contexts

parent 118cb232
No related branches found
No related tags found
1 merge request!6284More BC followup
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include "fchost_handler.h" #include "fchost_handler.h"
#include <iostream>
#include <sstream> #include <sstream>
#include <string> #include <string>
#include <fstream> #include <fstream>
...@@ -73,7 +74,13 @@ bool FCHostHandler::OnConsoleMessage(CefRefPtr<CefBrowser> browser, cef_log_seve ...@@ -73,7 +74,13 @@ bool FCHostHandler::OnConsoleMessage(CefRefPtr<CefBrowser> browser, cef_log_seve
const CefString& message, const CefString& source, int line) const CefString& message, const CefString& source, int line)
{ {
std::ofstream s("console.log", std::ios_base::app); std::ofstream s("console.log", std::ios_base::app);
s << DateTime() << " - " << source.c_str() << ":" << line << ": " << message.c_str() << "\n"; s << DateTime() << " - ";
if (source.c_str()) {
s << source.c_str();
} else {
s << "Unknown Source";
}
s << ":" << line << ": " << message.c_str() << "\n";
s.flush(); s.flush();
s.close(); s.close();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment