core, shop: Fix code using uninitialized memory

Sometimes buying items didn't work because the variable "result" wasn't initialized properly.