From d7ae7f54338a8ea02c34f4a969722182481eb72b Mon Sep 17 00:00:00 2001 From: Kevin Zakka Date: Tue, 31 May 2022 08:26:23 -0700 Subject: [PATCH] Improve error message when loading textures that are not PNGs. PiperOrigin-RevId: 452052514 Change-Id: Ic2f0e8717e43d1a17b2d07ac0e07efe96c5ae1bd --- src/user/user_objects.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/user/user_objects.cc b/src/user/user_objects.cc index b2d080b5..461fb4ce 100644 --- a/src/user/user_objects.cc +++ b/src/user/user_objects.cc @@ -2236,7 +2236,8 @@ void mjCTexture::LoadCustom(string filename, const mjVFS* vfs, mju_free(buffer); } - throw mjCError(this, "non-positive texture dimensions in file '%s'", filename.c_str()); + throw mjCError(this, "Non-PNG texture, assuming custom binary file format,\n" + "non-positive texture dimensions in file '%s'", filename.c_str()); } // check buffer size @@ -2245,7 +2246,8 @@ void mjCTexture::LoadCustom(string filename, const mjVFS* vfs, mju_free(buffer); } - throw mjCError(this, "unexpected file size in file '%s'", filename.c_str()); + throw mjCError(this, "Non-PNG texture, assuming custom binary file format,\n" + "unexpected file size in file '%s'", filename.c_str()); } // allocate and copy