diff --git a/README.md b/README.md index 9047d62..609ceb8 100644 --- a/README.md +++ b/README.md @@ -75,6 +75,7 @@ If using [Homebrew](http://brew.sh/): brew install lua brew install python brew install libevent + brew install jansson export CFLAGS="-I/usr/local/include -I/usr/local/Cellar/readline/6.3.8/include" export LDFLAGS="-L/usr/local/lib -L/usr/local/Cellar/readline/6.3.8/lib" ./configure && make diff --git a/interface.c b/interface.c index 8110533..0df696a 100644 --- a/interface.c +++ b/interface.c @@ -165,7 +165,7 @@ void socket_answer_add_printf (const char *format, ...) { } void socket_answer_end (struct in_ev *ev) { - if (ev->bev && socket_answer_pos > 0) { + if (ev->bev) { static char s[100]; sprintf (s, "ANSWER %d\n", socket_answer_pos); bufferevent_write (ev->bev, s, strlen (s)); @@ -3061,8 +3061,9 @@ void print_media (struct in_ev *ev, struct tgl_message_media *M) { case tgl_message_media_none: return; case tgl_message_media_photo: - assert (M->photo); - if (M->photo->caption && strlen (M->photo->caption)) { + if (!M->photo) { + mprintf (ev, "[photo bad]"); + } else if (M->photo->caption && strlen (M->photo->caption)) { mprintf (ev, "[photo %s]", M->photo->caption); } else { mprintf (ev, "[photo]"); diff --git a/main.c b/main.c index e109b41..adb3827 100644 --- a/main.c +++ b/main.c @@ -860,10 +860,12 @@ void do_halt (int error) { close (sfd); } - if(exit_code) + if (exit_code) { retval = exit_code; - else + } else { retval = error ? EXIT_FAILURE : EXIT_SUCCESS; + } + exit (retval); } diff --git a/tgl b/tgl index 5a4e6b6..41121e9 160000 --- a/tgl +++ b/tgl @@ -1 +1 @@ -Subproject commit 5a4e6b61839796e543d63900bb96e6325a9d9474 +Subproject commit 41121e9908fc5ddebe3ec6eca9f55172b630f21a