Skip to content

Commit

Permalink
Merge pull request #580 from sbesson/obj_id_mask_no_match
Browse files Browse the repository at this point in the history
omeroweb.webgateway.obj_id_bitmask: handle empty query results
  • Loading branch information
knabar authored Nov 1, 2024
2 parents d11fd1e + 1c8ad8d commit 213bb61
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions omeroweb/webgateway/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -3214,6 +3214,12 @@ def obj_id_bitmask(request, fileid, conn=None, query=None, **kwargs):
# accordingly.
col_name = column_names[0]
row_numbers = table.getWhereList(query, None, 0, 0, 1)
# If there are no matches for the query, don't call table.slice()
if len(row_numbers) == 0:
return HttpResponse(
numpy.packbits(numpy.array([0], dtype="int64")).tobytes(),
content_type="application/octet-stream",
)
(column,) = table.slice([column_names.index(col_name)], row_numbers).columns
try:
return HttpResponse(
Expand Down

0 comments on commit 213bb61

Please sign in to comment.