mirror of
https://github.com/GOSTSec/sgminer
synced 2025-02-05 11:34:16 +00:00
api.c allow NULL data displayed as (null)
This commit is contained in:
parent
37e95ced6b
commit
06f5f35ad4
10
api.c
10
api.c
@ -179,6 +179,7 @@ static const char *DYNAMIC = _DYNAMIC;
|
||||
|
||||
static const char *YES = "Y";
|
||||
static const char *NO = "N";
|
||||
static const char *NULLSTR = "(null)";
|
||||
|
||||
static const char *DEVICECODE = ""
|
||||
#ifdef HAVE_OPENCL
|
||||
@ -683,6 +684,13 @@ static struct api_data *api_add_data_full(struct api_data *root, char *name, enu
|
||||
|
||||
api_data->data_was_malloc = copy_data;
|
||||
|
||||
// Avoid crashing on bad data
|
||||
if (data == NULL) {
|
||||
api_data->type = type = API_CONST;
|
||||
data = (void *)NULLSTR;
|
||||
api_data->data_was_malloc = copy_data = false;
|
||||
}
|
||||
|
||||
if (!copy_data)
|
||||
api_data->data = data;
|
||||
else
|
||||
@ -1763,7 +1771,7 @@ static void summary(__maybe_unused SOCKETTYPE c, __maybe_unused char *param, boo
|
||||
#ifdef WANT_CPUMINE
|
||||
char *algo = (char *)(algo_names[opt_algo]);
|
||||
if (algo == NULL)
|
||||
algo = "(null)";
|
||||
algo = (char *)NULLSTR;
|
||||
#endif
|
||||
|
||||
utility = total_accepted / ( total_secs ? total_secs : 1 ) * 60;
|
||||
|
Loading…
x
Reference in New Issue
Block a user