Fix segmentation fault when pretext == NULL

This commit is contained in:
Jacob 2023-07-24 19:43:59 +02:00
parent 05a6663d16
commit 6b6d5b77c5
2 changed files with 3 additions and 3 deletions

View file

@ -475,7 +475,7 @@ int drawinput(int x, int y, int w) {
draw_text(draw, x, y, w, sp.bh, sp.lrpad / 2, isrtl ? fribidi_text : tx.text, 0, pango_input ? True : False, col_inputfg, col_inputbg, alpha_inputfg, alpha_inputbg); draw_text(draw, x, y, w, sp.bh, sp.lrpad / 2, isrtl ? fribidi_text : tx.text, 0, pango_input ? True : False, col_inputfg, col_inputbg, alpha_inputfg, alpha_inputbg);
curpos = TEXTW(tx.text) - TEXTW(&tx.text[sp.cursor]); curpos = TEXTW(tx.text) - TEXTW(&tx.text[sp.cursor]);
} else if (!hidepretext) { } else if (!hidepretext && pretext != NULL) {
apply_fribidi(pretext); apply_fribidi(pretext);
draw_text(draw, x + fw, y, w, sp.bh, sp.lrpad / 2, isrtl ? fribidi_text : pretext, 0, pango_pretext ? True : False, col_pretextfg, col_pretextbg, alpha_pretextfg, alpha_pretextbg); draw_text(draw, x + fw, y, w, sp.bh, sp.lrpad / 2, isrtl ? fribidi_text : pretext, 0, pango_pretext ? True : False, col_pretextfg, col_pretextbg, alpha_pretextfg, alpha_pretextbg);
} }

View file

@ -24,8 +24,8 @@ static char *bindsfile = NULL; /* Keybind file path. Default is
/* Window options */ /* Window options */
static int alpha = 1; /* Enable alpha */ static int alpha = 1; /* Enable alpha */
static int menuposition = 2; /* Position of the menu (0: Bottom, 1: Top, 2: Center */ static int menuposition = 2; /* Position of the menu (0: Bottom, 1: Top, 2: Center */
static int menupaddingv = 0; /* Vertical padding inside the menu (px) */ static int menupaddingv = 0; /* Vertical padding inside the menu (px) */
static int menupaddingh = 0; /* Horizontal padding inside the menu (px) */ static int menupaddingh = 0; /* Horizontal padding inside the menu (px) */
static int menuwidth = 0; /* spmenu width */ static int menuwidth = 0; /* spmenu width */
static int menumarginv = 0; /* Vertical padding around the menu */ static int menumarginv = 0; /* Vertical padding around the menu */
static int menumarginh = 0; /* Horizontal padding around the menu */ static int menumarginh = 0; /* Horizontal padding around the menu */