Commit b92cea6d authored by rsesek's avatar rsesek Committed by Commit bot

Remove unnecessary variable, the creation of which can cause a crash.

The NSFont object could be nil, which would have a NULL font name, which when
converted to a std::string would cause a crash. The font name is already in the
FontDescriptor, so it's entirely unnecessary.

BUG=452651
R=avi@chromium.org

Review URL: https://codereview.chromium.org/969683003

Cr-Commit-Position: refs/heads/master@{#318911}
parent 0d40d8ac
...@@ -93,12 +93,10 @@ void FontLoader::LoadFont(const FontDescriptor& font, ...@@ -93,12 +93,10 @@ void FontLoader::LoadFont(const FontDescriptor& font,
result->font_id = 0; result->font_id = 0;
NSFont* font_to_encode = font.ToNSFont(); NSFont* font_to_encode = font.ToNSFont();
// Used only for logging.
std::string font_name([[font_to_encode fontName] UTF8String]);
// Load appropriate NSFont. // Load appropriate NSFont.
if (!font_to_encode) { if (!font_to_encode) {
DLOG(ERROR) << "Failed to load font " << font_name; DLOG(ERROR) << "Failed to load font " << font.font_name;
return; return;
} }
...@@ -115,7 +113,7 @@ void FontLoader::LoadFont(const FontDescriptor& font, ...@@ -115,7 +113,7 @@ void FontLoader::LoadFont(const FontDescriptor& font,
base::mac::CFToNSCast(base::mac::CFCastStrict<CFURLRef>( base::mac::CFToNSCast(base::mac::CFCastStrict<CFURLRef>(
CTFontCopyAttribute(ct_font_to_encode, kCTFontURLAttribute)))); CTFontCopyAttribute(ct_font_to_encode, kCTFontURLAttribute))));
if (![font_url isFileURL]) { if (![font_url isFileURL]) {
DLOG(ERROR) << "Failed to find font file for " << font_name; DLOG(ERROR) << "Failed to find font file for " << font.font_name;
return; return;
} }
...@@ -135,7 +133,7 @@ void FontLoader::LoadFont(const FontDescriptor& font, ...@@ -135,7 +133,7 @@ void FontLoader::LoadFont(const FontDescriptor& font,
int32 font_file_size_32 = static_cast<int32>(font_file_size_64); int32 font_file_size_32 = static_cast<int32>(font_file_size_64);
if (!result->font_data.CreateAndMapAnonymous(font_file_size_32)) { if (!result->font_data.CreateAndMapAnonymous(font_file_size_32)) {
DLOG(ERROR) << "Failed to create shmem area for " << font_name; DLOG(ERROR) << "Failed to create shmem area for " << font.font_name;
return; return;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment