Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(237)

Side by Side Diff: core/src/fpdfdoc/doc_formfield.cpp

Issue 396173003: Adjust null object check (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: clean up Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « core/src/fpdfdoc/doc_ap.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "../../include/fpdfdoc/fpdf_doc.h" 7 #include "../../include/fpdfdoc/fpdf_doc.h"
8 CFX_WideString GetFullName(CPDF_Dictionary* pFieldDict); 8 CFX_WideString GetFullName(CPDF_Dictionary* pFieldDict);
9 void SaveCheckedFieldStatus(CPDF_FormField* pField, C FX_ByteArray& statusArray); 9 void SaveCheckedFieldStatus(CPDF_FormField* pField, C FX_ByteArray& statusArray);
10 FX_BOOL PDF_FormField_IsUnison(CPDF_FormField *pField) 10 FX_BOOL PDF_FormField_IsUnison(CPDF_FormField *pField)
(...skipping 1059 matching lines...) Expand 10 before | Expand all | Expand 10 after
1070 } 1070 }
1071 if (GetType() == ComboBox) { 1071 if (GetType() == ComboBox) {
1072 m_pForm->m_pFormNotify->AfterValueChange(this); 1072 m_pForm->m_pFormNotify->AfterValueChange(this);
1073 } 1073 }
1074 } 1074 }
1075 m_pForm->m_bUpdated = TRUE; 1075 m_pForm->m_bUpdated = TRUE;
1076 return TRUE; 1076 return TRUE;
1077 } 1077 }
1078 void CPDF_FormField::LoadDA() 1078 void CPDF_FormField::LoadDA()
1079 { 1079 {
1080 CFX_ByteString DA = FPDF_GetFieldAttr(m_pDict, "DA") ? FPDF_GetFieldAttr(m_p Dict, "DA")->GetString() : CFX_ByteString(); 1080 CFX_ByteString DA;
1081 if (DA.IsEmpty()) { 1081 if (CPDF_Object* pObj_t = FPDF_GetFieldAttr(m_pDict, "DA")) {
1082 DA = m_pForm->m_pFormDict ? m_pForm->m_pFormDict->GetString("DA") : CFX_ ByteString(); 1082 DA = pObj_t->GetString();
1083 }
1084 if (DA.IsEmpty() && m_pForm->m_pFormDict) {
1085 DA = m_pForm->m_pFormDict->GetString("DA");
1083 } 1086 }
1084 if (DA.IsEmpty()) { 1087 if (DA.IsEmpty()) {
1085 return; 1088 return;
1086 } 1089 }
1087 CPDF_SimpleParser syntax(DA); 1090 CPDF_SimpleParser syntax(DA);
1088 syntax.FindTagParam("Tf", 2); 1091 syntax.FindTagParam("Tf", 2);
1089 CFX_ByteString font_name = syntax.GetWord(); 1092 CFX_ByteString font_name = syntax.GetWord();
1090 CPDF_Dictionary* pFontDict = NULL; 1093 CPDF_Dictionary* pFontDict = NULL;
1091 if (m_pForm->m_pFormDict && m_pForm->m_pFormDict->GetDict("DR") && 1094 if (m_pForm->m_pFormDict && m_pForm->m_pFormDict->GetDict("DR") &&
1092 m_pForm->m_pFormDict->GetDict("DR")->GetDict("Font") ) 1095 m_pForm->m_pFormDict->GetDict("DR")->GetDict("Font") )
1093 pFontDict = m_pForm->m_pFormDict->GetDict("DR")->GetDict("Font")->GetDict(fo nt_name); 1096 pFontDict = m_pForm->m_pFormDict->GetDict("DR")->GetDict("Font")->GetDict(fo nt_name);
1094 1097
1095 if (pFontDict == NULL) { 1098 if (pFontDict == NULL) {
1096 return; 1099 return;
1097 } 1100 }
1098 m_pFont = m_pForm->m_pDocument->LoadFont(pFontDict); 1101 m_pFont = m_pForm->m_pDocument->LoadFont(pFontDict);
1099 m_FontSize = FX_atof(syntax.GetWord()); 1102 m_FontSize = FX_atof(syntax.GetWord());
1100 } 1103 }
OLDNEW
« no previous file with comments | « core/src/fpdfdoc/doc_ap.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698