MTL file with jpg cause errors (FIXED)

So I did this tutorial:
Learning three.js 01 :: Getting Started - Learning three.js 01 :: Getting Started - YouTube

It shows you how to make a simple first persoon shooter. Everything was fine and I build my first game where I could walk arround. Until I tried to add my own OBJ + MTL files… These MTL files contain .jpg textures. Everytime when I add the MTL file the scene doesn’t start. I think there’s something wrong with the loader but I can’t figure out what…

This is the loader I’m using:

This is the error I’m getting:

Uncaught TypeError: Cannot read property 'setCrossOrigin' of undefined
at THREE.MTLLoader.MaterialCreator.loadTexture (MTLLoader.js:467)
at THREE.MTLLoader.MaterialCreator.createMaterial_ (MTLLoader.js:393)
at THREE.MTLLoader.MaterialCreator.create (MTLLoader.js:329)
at THREE.MTLLoader.MaterialCreator.preload (MTLLoader.js:297)
at index.html:175
at Object.onLoad (MTLLoader.js:36)
at XMLHttpRequest.<anonymous> (three.min.js:6)

What does this mean and what can I do to fix this?

All advices and tips are welcome. I thank you in advance for the help.

Update:
So I’ve changed loader === null to !loader in MTLloader.js. This made it all work :slight_smile: