< prev index next >
src/jdk.incubator.jpackage/share/native/libapplauncher/IniFile.cpp
Print this page
@@ -107,13 +107,13 @@
std::list<TString> contents;
std::vector<TString> keys = FMap.GetKeys();
for (unsigned int index = 0; index < keys.size(); index++) {
TString name = keys[index];
- IniSectionData *section;
+ IniSectionData *section = NULL;
- if (FMap.GetValue(name, section) == true) {
+ if (FMap.GetValue(name, section) == true && section != NULL) {
contents.push_back(_T("[") + name + _T("]"));
std::list<TString> lines = section->GetLines();
contents.insert(contents.end(), lines.begin(), lines.end());
contents.push_back(_T(""));
}
@@ -126,11 +126,11 @@
}
void IniFile::Append(const TString SectionName,
const TString Key, TString Value) {
if (FMap.ContainsKey(SectionName) == true) {
- IniSectionData* section;
+ IniSectionData* section = NULL;
if (FMap.GetValue(SectionName, section) == true && section != NULL) {
section->SetValue(Key, Value);
}
}
@@ -142,11 +142,11 @@
}
void IniFile::AppendSection(const TString SectionName,
OrderedMap<TString, TString> Values) {
if (FMap.ContainsKey(SectionName) == true) {
- IniSectionData* section;
+ IniSectionData* section = NULL;
if (FMap.GetValue(SectionName, section) == true && section != NULL) {
section->Append(Values);
}
}
@@ -157,11 +157,11 @@
}
bool IniFile::GetValue(const TString SectionName,
const TString Key, TString& Value) {
bool result = false;
- IniSectionData* section;
+ IniSectionData* section = NULL;
if (FMap.GetValue(SectionName, section) == true && section != NULL) {
result = section->GetValue(Key, Value);
}
@@ -169,11 +169,11 @@
}
bool IniFile::SetValue(const TString SectionName,
const TString Key, TString Value) {
bool result = false;
- IniSectionData* section;
+ IniSectionData* section = NULL;
if (FMap.GetValue(SectionName, section) && section != NULL) {
result = section->SetValue(Key, Value);
}
else {
< prev index next >