core: check that callback is not NULL in function string_replace_with_callback