login: Don't show an empty / undefined code of conduct.
All checks were successful
Build Tilde Friends / Build-All (push) Successful in 10m26s

This commit is contained in:
2025-11-19 12:39:06 -05:00
parent 35f374047a
commit dae38bbd83
2 changed files with 9 additions and 3 deletions

View File

@@ -352,7 +352,7 @@ static void _httpd_endpoint_login_work(tf_ssb_t* ssb, void* user_data)
{
JSValue settings_value = JS_ParseJSON(context, login->settings, strlen(login->settings), NULL);
JSValue code_of_conduct_value = JS_GetPropertyStr(context, settings_value, "code_of_conduct");
const char* code_of_conduct = JS_ToCString(context, code_of_conduct_value);
const char* code_of_conduct = JS_IsString(code_of_conduct_value) ? JS_ToCString(context, code_of_conduct_value) : NULL;
const char* result = tf_strdup(code_of_conduct);
JS_FreeCString(context, code_of_conduct);
JS_FreeValue(context, code_of_conduct_value);