comparison mod_rest/jsonmap.lib.lua @ 4251:d33b480befcb

mod_rest: Fix attempt at indexing nil if an error stanza is missing <error>
author Kim Alvefur <zash@zash.se>
date Sun, 15 Nov 2020 16:31:08 +0100
parents 270cd50852be
children e8b9228b5265
comparison
equal deleted inserted replaced
4250:8b489203e4d3 4251:d33b480befcb
465 local err_typ, err_condition, err_text = s:get_error(); 465 local err_typ, err_condition, err_text = s:get_error();
466 t.error = { 466 t.error = {
467 type = err_typ, 467 type = err_typ,
468 condition = err_condition, 468 condition = err_condition,
469 text = err_text, 469 text = err_text,
470 by = error.attr.by, 470 by = error and error.attr.by or nil,
471 }; 471 };
472 return t; 472 return t;
473 end 473 end
474 474
475 for k, mapping in pairs(field_mappings) do 475 for k, mapping in pairs(field_mappings) do