etesync / libetebase

The C client-side library
BSD 3-Clause "New" or "Revised" License
29 stars 9 forks source link

etebase_error_get_message() crash application #2

Closed knacky34 closed 3 years ago

knacky34 commented 3 years ago

call of etebase_error_get_message() seems to crash the application.

step to reproduce

#include <iostream>
#include <etebase/etebase.h>

int main() {
    EtebaseClient *client = etebase_client_new("a", "https://example.com");
    std::cout << "error: " << etebase_error_get_message() << std::endl;
    std::cout << "test" << std::endl;

    return 0;
}
tasn commented 3 years ago

If I had to guess, it's because it didn't error so the return is NULL. You should only call this function if client is NULL (so the previous call failed).

knacky34 commented 3 years ago

You're right the function return nullptr if there is no error Thank you

tasn commented 3 years ago

Glad it's solved!