readline: don't dereference possible NULL pointer

This commit is contained in:
Jethro Grassie 2019-01-12 01:50:59 -05:00
parent 4e72384318
commit ca86ef1beb
No known key found for this signature in database
GPG Key ID: DE8ED755616565BB

View File

@ -114,7 +114,7 @@ int rdln::readline_buffer::sync()
int end = 0, point = 0;
#endif
if (rl_end || *rl_prompt)
if (rl_end || (rl_prompt && *rl_prompt))
{
#if RL_READLINE_VERSION >= 0x0700
rl_clear_visible_line();
@ -137,7 +137,7 @@ int rdln::readline_buffer::sync()
while ( this->snextc() != EOF );
#if RL_READLINE_VERSION < 0x0700
if (end || *rl_prompt)
if (end || (rl_prompt && *rl_prompt))
{
rl_restore_prompt();
rl_line_buffer = line;