Fix undefined variable when uninstalling an app

Fixes #9842

cc @jancborchardt