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

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: 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
« core/src/fpdfdoc/doc_ap.cpp ('K') | « 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 if (!m_pForm->m_pFormDict) {
1081 if (DA.IsEmpty()) { 1081 return;
1082 DA = m_pForm->m_pFormDict ? m_pForm->m_pFormDict->GetString("DA") : CFX_ ByteString(); 1082 }
1083 CFX_ByteString DA;
1084 CPDF_Object* pObj_t = FPDF_GetFieldAttr(m_pDict, "DA");
1085 if (pObj_t) {
Nico 2014/07/21 05:07:53 You can write if (CPDF_Object* pObj_t = FPDF_Ge
1086 DA = pObj_t->GetString();
1083 } 1087 }
Nico 2014/07/21 05:07:53 This is different from the previous code as far as
Bo Xu 2014/07/21 16:40:44 Done.
1084 if (DA.IsEmpty()) { 1088 if (DA.IsEmpty()) {
1085 return; 1089 return;
1086 } 1090 }
1087 CPDF_SimpleParser syntax(DA); 1091 CPDF_SimpleParser syntax(DA);
1088 syntax.FindTagParam("Tf", 2); 1092 syntax.FindTagParam("Tf", 2);
1089 CFX_ByteString font_name = syntax.GetWord(); 1093 CFX_ByteString font_name = syntax.GetWord();
1090 CPDF_Dictionary* pFontDict = NULL; 1094 CPDF_Dictionary* pFontDict = NULL;
1091 if (m_pForm->m_pFormDict && m_pForm->m_pFormDict->GetDict("DR") && 1095 if (m_pForm->m_pFormDict && m_pForm->m_pFormDict->GetDict("DR") &&
1092 m_pForm->m_pFormDict->GetDict("DR")->GetDict("Font") ) 1096 m_pForm->m_pFormDict->GetDict("DR")->GetDict("Font") )
1093 pFontDict = m_pForm->m_pFormDict->GetDict("DR")->GetDict("Font")->GetDict(fo nt_name); 1097 pFontDict = m_pForm->m_pFormDict->GetDict("DR")->GetDict("Font")->GetDict(fo nt_name);
1094 1098
1095 if (pFontDict == NULL) { 1099 if (pFontDict == NULL) {
1096 return; 1100 return;
1097 } 1101 }
1098 m_pFont = m_pForm->m_pDocument->LoadFont(pFontDict); 1102 m_pFont = m_pForm->m_pDocument->LoadFont(pFontDict);
1099 m_FontSize = FX_atof(syntax.GetWord()); 1103 m_FontSize = FX_atof(syntax.GetWord());
1100 } 1104 }
OLDNEW
« core/src/fpdfdoc/doc_ap.cpp ('K') | « core/src/fpdfdoc/doc_ap.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698