Add additional checks for NULL pointers to fix several crashes reported.


			
			
				changes/61/61/1
			
			
		
Igor Goncharovskiy 11 years ago
parent cfa7763f85
commit 865aa54aac

@ -2550,6 +2550,9 @@ static void *unistim_ss(void *data)
struct unistimsession *s = l->parent->session; struct unistimsession *s = l->parent->session;
int res; int res;
if (!s) {
return NULL;
}
ast_verb(3, "Starting switch on '%s@%s-%d' to %s\n", l->name, l->parent->name, sub->softkey, s->device->phone_number); ast_verb(3, "Starting switch on '%s@%s-%d' to %s\n", l->name, l->parent->name, sub->softkey, s->device->phone_number);
ast_channel_exten_set(chan, s->device->phone_number); ast_channel_exten_set(chan, s->device->phone_number);
ast_copy_string(s->device->redial_number, s->device->phone_number, ast_copy_string(s->device->redial_number, s->device->phone_number,
@ -3306,6 +3309,9 @@ static void key_call(struct unistimsession *pte, char keycode)
struct unistim_subchannel *sub = get_sub(pte->device, SUB_REAL); struct unistim_subchannel *sub = get_sub(pte->device, SUB_REAL);
struct unistim_subchannel *sub_3way = get_sub(pte->device, SUB_THREEWAY); struct unistim_subchannel *sub_3way = get_sub(pte->device, SUB_THREEWAY);
if (!sub) {
return;
}
if ((keycode >= KEY_0) && (keycode <= KEY_SHARP)) { if ((keycode >= KEY_0) && (keycode <= KEY_SHARP)) {
if (keycode == KEY_SHARP) { if (keycode == KEY_SHARP) {
keycode = '#'; keycode = '#';
@ -3319,7 +3325,7 @@ static void key_call(struct unistimsession *pte, char keycode)
} }
switch (keycode) { switch (keycode) {
case KEY_FUNC1: case KEY_FUNC1:
if (ast_channel_state(sub->owner) == AST_STATE_UP) { if (sub->owner && ast_channel_state(sub->owner) == AST_STATE_UP) {
if (sub_3way) { if (sub_3way) {
close_call(pte); close_call(pte);
} }
@ -3361,8 +3367,8 @@ static void key_call(struct unistimsession *pte, char keycode)
MUTE_OFF); MUTE_OFF);
break; break;
case KEY_MUTE: case KEY_MUTE:
if (!sub || !sub->owner) { if (!sub->owner) {
ast_log(LOG_WARNING, "Unable to find subchannel for music on hold\n"); ast_log(LOG_WARNING, "Unable to find channel for music on hold\n");
return; return;
} }
if (!sub->moh) { if (!sub->moh) {

Loading…
Cancel
Save