[FL-2493] Infrared: fix crash on invalid name. Input: cancel info in dump command. (#1153)

* Infrared: fix crash on invalid name. Input: cancel info in dump command.
* FuriHal: add abort handler
This commit is contained in:
あく 2022-04-23 04:56:59 +03:00 committed by GitHub
parent cc99ce1f07
commit b28d408b49
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 14 deletions

View File

@ -14,7 +14,9 @@ int32_t InfraredApp::run(void* args) {
if(args) { if(args) {
std::string path = static_cast<const char*>(args); std::string path = static_cast<const char*>(args);
std::string remote_name(path, path.find_last_of('/') + 1, path.size()); std::string remote_name(path, path.find_last_of('/') + 1, path.size());
remote_name.erase(remote_name.find_last_of('.')); auto last_dot = remote_name.find_last_of('.');
if(last_dot != std::string::npos) {
remote_name.erase(last_dot);
path.erase(path.find_last_of('/')); path.erase(path.find_last_of('/'));
bool result = remote_manager.load(path, remote_name); bool result = remote_manager.load(path, remote_name);
if(result) { if(result) {
@ -24,6 +26,7 @@ int32_t InfraredApp::run(void* args) {
return -1; return -1;
} }
} }
}
scenes[current_scene]->on_enter(this); scenes[current_scene]->on_enter(this);

View File

@ -24,19 +24,15 @@ static void input_cli_dump(Cli* cli, string_t args, Input* input) {
FuriPubSubSubscription* input_subscription = FuriPubSubSubscription* input_subscription =
furi_pubsub_subscribe(input->event_pubsub, input_cli_dump_events_callback, input_queue); furi_pubsub_subscribe(input->event_pubsub, input_cli_dump_events_callback, input_queue);
bool stop = false;
InputEvent input_event; InputEvent input_event;
while(!stop) { printf("Press CTRL+C to stop\r\n");
while(!cli_cmd_interrupt_received(cli)) {
if(osMessageQueueGet(input_queue, &input_event, NULL, 100) == osOK) { if(osMessageQueueGet(input_queue, &input_event, NULL, 100) == osOK) {
printf( printf(
"key: %s type: %s\r\n", "key: %s type: %s\r\n",
input_get_key_name(input_event.key), input_get_key_name(input_event.key),
input_get_type_name(input_event.type)); input_get_type_name(input_event.type));
} }
if(cli_cmd_interrupt_received(cli)) {
stop = true;
}
} }
furi_pubsub_unsubscribe(input->event_pubsub, input_subscription); furi_pubsub_unsubscribe(input->event_pubsub, input_subscription);

View File

@ -65,6 +65,10 @@ void Error_Handler(void) {
furi_crash("ErrorHandler"); furi_crash("ErrorHandler");
} }
void abort() {
furi_crash("AbortHandler");
}
#ifdef USE_FULL_ASSERT #ifdef USE_FULL_ASSERT
/** /**
* @brief Reports the name of the source file and the source line number * @brief Reports the name of the source file and the source line number