goto ERROR;
}
+ // Check if the instance was created properly
+ if (r == 0 && !t->pakfire) {
+ LOG("ERROR: Pakfire was not initialized, but no error was raised: %m\n");
+ goto ERROR;
+ }
+
// Copy command into environment
r = pakfire_copy_in(t->pakfire, TEST_STUB_COMMAND, "/command");
if (r) {
ERROR:
// Release pakfire
- p = pakfire_unref(t->pakfire);
+ if (t->pakfire) {
+ p = pakfire_unref(t->pakfire);
- // Check if Pakfire was actually released
- if (p) {
- LOG("Error: Pakfire instance was not released in test %d\n", i);
- return 1;
- }
+ // Check if Pakfire was actually released
+ if (p) {
+ LOG("Error: Pakfire instance was not released in test %d\n", i);
+ return 1;
+ }
- // Reset pointer (just in case)
- t->pakfire = NULL;
+ // Reset pointer (just in case)
+ t->pakfire = NULL;
+ }
// Cleanup root
pakfire_rmtree(root, 0);