js-mdict icon indicating copy to clipboard operation
js-mdict copied to clipboard

mdict.js _findList 返回值可能是 undefined,后续取值会报错

Open tonyzhou1890 opened this issue 3 years ago • 1 comments

  _findList(word) {
    const findListInternal = (compareFn) => {
      const sfunc = this._stripKey();
      const kbid = this._reduceWordKeyBlock(word, sfunc, compareFn);
      // not found
      if (kbid < 0) {
        return undefined;
      }
      return { sfunc, kbid, list: this._decodeKeyBlockByKBID(kbid) };
    };

    let list;
    if (this._isKeyCaseSensitive()) {
      list = findListInternal(common.normalUpperCaseWordCompare);
    } else {
      list = findListInternal(common.normalUpperCaseWordCompare);
      if (list === undefined) {
        list = findListInternal(common.wordCompare);
      }
    }
    return list;
  }

findListInternal 会返回 undefined,后续操作报错,比如:this._findList(phrase).list

tonyzhou1890 avatar Oct 16 '21 07:10 tonyzhou1890

感谢反馈,我会尽快修复该问题

terasum avatar Oct 17 '21 16:10 terasum

本问题已经修复。

terasum avatar Mar 25 '23 13:03 terasum