45026831 / hh-plus-plus

12 stars 15 forks source link

[bug] onAjaxResponse() crash if ajax response doesn't contains data #58

Closed DevilPF closed 2 years ago

DevilPF commented 2 years ago

Describe the bug onAjaxResponse() crash with "Uncaught TypeError: Cannot read properties of undefined (reading 'search')" if ajax response doesn't contains data. E.g. on response from another script it the response is not json.

To Reproduce Steps to reproduce the behavior:

  1. open console
  2. do Ajax request - e.g. $.ajax({dataType: 'json', url: "https://some.url" })
  3. See error

Expected behavior Not throw an exception.

Screenshots

Version info (please complete the following information):

Additional context

It should be sufficient to modify onAjaxResponse in src\common\Helpers.js instead of "~a.data.search(s)" test it first - "a.data && ~a.data.search(s)"

45026831 commented 2 years ago

Fixed in v1.7.6