Skip to content

Commit

Permalink
fix fieldDataArray.values is nullptr when meet first empty array
Browse files Browse the repository at this point in the history
  • Loading branch information
amorynan committed May 20, 2024
1 parent 315b25b commit d57278e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/core/CLucene/index/SDocumentWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,12 @@ void SDocumentsWriter<T>::ThreadState::resetCurrentFieldData(Document *doc) {
const Document::FieldsType &docFields = *doc->getFields();
const int32_t numDocFields = docFields.size();

if (FieldData* fp = fieldDataArray.values[0]; fp && numDocFields > 0) {
if (FieldData* fp = fieldDataArray.values[0]; numDocFields > 0) {
// maybe here fp has not been initialized
if (!fp) {
init(doc, docID+1);
fp = fieldDataArray.values[0];
}
numFieldData = 1;
// reset fp for new fields
fp->fieldCount = 0;
Expand Down

0 comments on commit d57278e

Please sign in to comment.