]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
bridge.c: Fixed null pointer exception
authorsungtae kim <pchero21@gmail.com>
Fri, 29 May 2020 01:03:24 +0000 (03:03 +0200)
committerJoshua Colp <jcolp@sangoma.com>
Fri, 5 Jun 2020 10:34:12 +0000 (05:34 -0500)
If the bridge show all command could not get the bridge snapshot, it causes null pointer exception.
Fixed it to check the snapshot is null.

ASTERISK-28920

Change-Id: I3521fc1b832bfc69644d0833f2c78177e1e51f58

main/bridge.c

index c13cda2e1a462e150847e58e1faddf84a49249e5..fb7012df33e86dc5530bf4c63d1fa03635dda80e 100644 (file)
@@ -5086,9 +5086,8 @@ static char *handle_bridge_show_all(struct ast_cli_entry *e, int cmd, struct ast
                struct ast_bridge_snapshot *snapshot = ast_bridge_get_snapshot(bridge);
                char print_time[32];
 
-               ast_format_duration_hh_mm_ss(ast_tvnow().tv_sec - snapshot->creationtime.tv_sec, print_time, sizeof(print_time));
-
                if (snapshot) {
+                       ast_format_duration_hh_mm_ss(ast_tvnow().tv_sec - snapshot->creationtime.tv_sec, print_time, sizeof(print_time));
                        ast_cli(a->fd, FORMAT_ROW,
                                snapshot->uniqueid,
                                snapshot->num_channels,