libmid: fix potential crash