term/protos: Do not call callback if NULL

This commit is contained in:
mintsuki 2022-04-17 07:51:28 +02:00
parent ddf248aaf8
commit fbf1e1584e
2 changed files with 11 additions and 7 deletions

View File

@ -494,12 +494,14 @@ FEAT_START
fb = fbinfo;
if (terminal_request->callback != 0) {
#if defined (__i386__)
term_callback = stivale2_term_callback;
stivale2_term_callback_ptr = terminal_request->callback;
term_callback = stivale2_term_callback;
stivale2_term_callback_ptr = terminal_request->callback;
#elif defined (__x86_64__)
term_callback = (void *)terminal_request->callback;
term_callback = (void *)terminal_request->callback;
#endif
}
term_arg = reported_addr(terminal);
@ -731,7 +733,7 @@ FEAT_START
memmap_request->response = reported_addr(memmap_response);
FEAT_END
// Clear terminal for kernels that will use the stivale2 terminal
// Clear terminal for kernels that will use the Limine terminal
term_write((uint64_t)(uintptr_t)("\e[2J\e[H"), 7);
term_runtime = true;

View File

@ -555,12 +555,14 @@ failed_to_load_header_section:
if (terminal_hdr_tag->flags & (1 << 0)) {
// We provide callback
tag->flags |= (1 << 2);
if (terminal_hdr_tag->callback != 0) {
#if defined (__i386__)
term_callback = stivale2_term_callback;
stivale2_term_callback_ptr = terminal_hdr_tag->callback;
term_callback = stivale2_term_callback;
stivale2_term_callback_ptr = terminal_hdr_tag->callback;
#elif defined (__x86_64__)
term_callback = (void *)terminal_hdr_tag->callback;
term_callback = (void *)terminal_hdr_tag->callback;
#endif
}
}
// We provide max allowed string length