Skip to content

Commit fcd464f

Browse files
committed
Fix OpenAI debug crash with keyless backends
1 parent 1f41b6d commit fcd464f

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/openai.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,10 @@ R_IPI R2AI_ChatResponse *r2ai_openai(RCorePluginSession *cps, R2AIArgs args) {
193193
if (r_config_get_b (core->config, "r2ai.debug")) {
194194
// Generate curl command for debugging
195195
RStrBuf *curl_cmd = r_strbuf_new ("curl -X POST");
196-
for (int i = 0; headers[i]; i++) {
197-
r_strbuf_appendf (curl_cmd, " -H \"%s\"", headers[i]);
196+
if (headers) {
197+
for (int i = 0; headers[i]; i++) {
198+
r_strbuf_appendf (curl_cmd, " -H \"%s\"", headers[i]);
199+
}
198200
}
199201
r_strbuf_appendf (curl_cmd, " -d '%s' \"%s\"", complete_json, openai_url);
200202
eprintf ("Curl command: %s\n", r_strbuf_get (curl_cmd));

0 commit comments

Comments
 (0)