mesa: fix assertion failure in TexImage

Check the assertion after error checking.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=111194

Fixes: 9dd1f7ce ("mesa: pass gl_texture_object as arg to not depend on state")
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
13 jobs for !1420 with teximage-assert-fix in 18 minutes and 58 seconds (queued for 49 seconds)
latest detached
Status Job ID Name Coverage
  Containers Build
passed #439156
debian

00:00:21

 
  Build+Test
passed #439165
meson-arm64

00:03:27

passed #439164
meson-armhf

00:03:46

passed #439158
meson-clang

00:05:13

passed #439162
meson-clover

00:11:35

passed #439166
meson-i386

00:04:38

passed #439161
meson-main

00:03:13

passed #439157
meson-swr-glvnd

00:05:41

passed #439163
meson-vulkan

00:03:37

passed #439168
scons-llvm

00:06:33

passed #439167
scons-nollvm

00:04:46

passed #439159
scons-swr

00:05:30

passed #439160
scons-win64

00:10:42