fix(params-factory): add data propery check (#231)

This commit is contained in:
Morbo 2021-01-23 19:50:32 +03:00 committed by GitHub
parent c7bc618c31
commit 0c50fca66e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -18,9 +18,9 @@ export class TelegrafParamsFactory implements ParamsFactory {
case TelegrafParamtype.NEXT: case TelegrafParamtype.NEXT:
return next; return next;
case TelegrafParamtype.SENDER: case TelegrafParamtype.SENDER:
return ctx.from ? ctx.from[data as string] : ctx.from; return data && ctx.from ? ctx.from[data as string] : ctx.from;
case TelegrafParamtype.MESSAGE: case TelegrafParamtype.MESSAGE:
return ctx.message ? ctx.message[data as string] : ctx.message; return data && ctx.message ? ctx.message[data as string] : ctx.message;
default: default:
return null; return null;
} }