if (argv[1] && !strcasecmp(argv[1], "count")) {
switch_snprintfv(sql, sizeof(sql), "select count(*) from basic_calls where hostname='%q'", switch_core_get_switchname());
holder.justcount = 1;
- if (argv[3] && !strcasecmp(argv[2], "as")) {
+ if (argv[2] && argv[3] && !strcasecmp(argv[2], "as")) {
as = argv[3];
}
}
if (argv[1] && !strcasecmp(argv[1], "count")) {
switch_snprintfv(sql, sizeof(sql), "select count(*) from registrations where hostname='%q'", switch_core_get_switchname());
holder.justcount = 1;
- if (argv[3] && !strcasecmp(argv[2], "as")) {
+ if (argv[2] && argv[3] && !strcasecmp(argv[2], "as")) {
as = argv[3];
}
}
if (argv[1] && !strcasecmp(argv[1], "count")) {
switch_snprintfv(sql, sizeof(sql), "select count(*) from channels where hostname='%q'", switch_core_get_switchname());
holder.justcount = 1;
- if (argv[3] && !strcasecmp(argv[2], "as")) {
+ if (argv[2] && argv[3] && !strcasecmp(argv[2], "as")) {
as = argv[3];
}
}