[libtaskmanager] Fix null check for window
window() may be null. We check for that, but 5a3ef9e8 introduced code that uses window() before the check.
Move the check before the relevant code to fix that
window() may be null. We check for that, but 5a3ef9e8 introduced code that uses window() before the check.
Move the check before the relevant code to fix that