mirror of
https://github.com/davatorium/rofi.git
synced 2025-02-10 15:44:41 -05:00
[Helper] Add more error checking/reporting.
This commit is contained in:
parent
f49866bd8b
commit
3c56761a76
1 changed files with 6 additions and 3 deletions
|
@ -1288,11 +1288,14 @@ char *helper_string_replace_if_exists ( char * string, ... )
|
||||||
*/
|
*/
|
||||||
char *helper_string_replace_if_exists_v ( char * string, GHashTable *h )
|
char *helper_string_replace_if_exists_v ( char * string, GHashTable *h )
|
||||||
{
|
{
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
char *res = NULL;
|
||||||
|
|
||||||
// Replace hits within {-\w+}.
|
// Replace hits within {-\w+}.
|
||||||
GRegex *reg = g_regex_new ( "\\[(.*)({[-\\w]+})(.*)\\]|({[\\w-]+})", 0, 0, NULL );
|
GRegex *reg = g_regex_new ( "\\[(.*)({[-\\w]+})(.*)\\]|({[\\w-]+})", 0, 0, &error );
|
||||||
char *res = g_regex_replace_eval ( reg, string, -1, 0, 0, helper_eval_cb2, h, NULL );
|
if ( error == NULL ){
|
||||||
|
res = g_regex_replace_eval ( reg, string, -1, 0, 0, helper_eval_cb2, h, &error );
|
||||||
|
}
|
||||||
// Free regex.
|
// Free regex.
|
||||||
g_regex_unref ( reg );
|
g_regex_unref ( reg );
|
||||||
// Throw error if shell parsing fails.
|
// Throw error if shell parsing fails.
|
||||||
|
|
Loading…
Add table
Reference in a new issue