mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 01:59:02 +00:00
Check for NULL pointer earlier
Reported by Coverity
(cherry picked from commit 5ec247a957
)
This commit is contained in:
parent
4e2b1e1bbb
commit
b185ffeddc
@ -186,6 +186,8 @@ void GuiBibtex::selUpdated()
|
|||||||
// check for current file encodings
|
// check for current file encodings
|
||||||
for (int i = 0; i != selected_model_.rowCount(); ++i) {
|
for (int i = 0; i != selected_model_.rowCount(); ++i) {
|
||||||
QStandardItem const * key = selected_model_.item(i, 0);
|
QStandardItem const * key = selected_model_.item(i, 0);
|
||||||
|
if (!key)
|
||||||
|
continue;
|
||||||
QComboBox * cb = qobject_cast<QComboBox*>(selectedLV->indexWidget(selected_model_.index(i, 1)));
|
QComboBox * cb = qobject_cast<QComboBox*>(selectedLV->indexWidget(selected_model_.index(i, 1)));
|
||||||
QString fenc = cb ? cb->itemData(cb->currentIndex()).toString() : QString();
|
QString fenc = cb ? cb->itemData(cb->currentIndex()).toString() : QString();
|
||||||
if (fenc.isEmpty())
|
if (fenc.isEmpty())
|
||||||
@ -193,7 +195,7 @@ void GuiBibtex::selUpdated()
|
|||||||
else
|
else
|
||||||
cached_file_encodings_[key->text()] = fenc;
|
cached_file_encodings_[key->text()] = fenc;
|
||||||
docstring const enc = qstring_to_ucs4(key->text()) + " " + qstring_to_ucs4(fenc);
|
docstring const enc = qstring_to_ucs4(key->text()) + " " + qstring_to_ucs4(fenc);
|
||||||
if (key && !key->text().isEmpty() && !fenc.isEmpty() && fenc != "general")
|
if (!key->text().isEmpty() && !fenc.isEmpty() && fenc != "general")
|
||||||
nfe.push_back(enc);
|
nfe.push_back(enc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -326,10 +328,12 @@ void GuiBibtex::updateFileEncodings()
|
|||||||
vector<docstring> nfe;
|
vector<docstring> nfe;
|
||||||
for (int i = 0; i != selected_model_.rowCount(); ++i) {
|
for (int i = 0; i != selected_model_.rowCount(); ++i) {
|
||||||
QStandardItem const * key = selected_model_.item(i, 0);
|
QStandardItem const * key = selected_model_.item(i, 0);
|
||||||
|
if (!key)
|
||||||
|
continue;
|
||||||
QComboBox * cb = qobject_cast<QComboBox*>(selectedLV->indexWidget(selected_model_.index(i, 1)));
|
QComboBox * cb = qobject_cast<QComboBox*>(selectedLV->indexWidget(selected_model_.index(i, 1)));
|
||||||
QString fenc = cb ? cb->itemData(cb->currentIndex()).toString() : QString();
|
QString fenc = cb ? cb->itemData(cb->currentIndex()).toString() : QString();
|
||||||
docstring const enc = qstring_to_ucs4(key->text()) + " " + qstring_to_ucs4(fenc);
|
docstring const enc = qstring_to_ucs4(key->text()) + " " + qstring_to_ucs4(fenc);
|
||||||
if (key && !key->text().isEmpty() && !fenc.isEmpty() && fenc != "general")
|
if (!key->text().isEmpty() && !fenc.isEmpty() && fenc != "general")
|
||||||
nfe.push_back(enc);
|
nfe.push_back(enc);
|
||||||
}
|
}
|
||||||
if (!nfe.empty()) {
|
if (!nfe.empty()) {
|
||||||
|
@ -84,6 +84,7 @@ What's new
|
|||||||
|
|
||||||
* INTERNALS
|
* INTERNALS
|
||||||
|
|
||||||
|
- Fix some defects found by Coverity.
|
||||||
|
|
||||||
|
|
||||||
* DOCUMENTATION AND LOCALIZATION
|
* DOCUMENTATION AND LOCALIZATION
|
||||||
|
Loading…
Reference in New Issue
Block a user