Skip to content

Commit

Permalink
Fixed a crash when requesting a file with an unrecognized extension v…
Browse files Browse the repository at this point in the history
…ia CEF
  • Loading branch information
sbx320 committed Jul 21, 2015
1 parent 115f140 commit 1d1443a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions MTA10/core/CWebCore.cpp
Expand Up @@ -805,8 +805,11 @@ CefRefPtr<CefResourceHandler> CCefApp::Create ( CefRefPtr<CefBrowser> browser, C
size_t pos = path.find_last_of('.');
if (pos != std::string::npos)
mimeType = CefGetMimeType ( path.substr ( pos + 1 ) );
else
mimeType = "text/plain";

// Make sure we provide a mime type, even
// when we cannot deduct it from the file extension
if ( mimeType.empty( ) )
mimeType = "application/octet-stream";

auto stream = CefStreamReader::CreateForFile ( path );
if ( stream.get () )
Expand Down

0 comments on commit 1d1443a

Please sign in to comment.