Assignment 3: Fix issue detected by the static analyser

"Access to instance variable '_weights' results in a dereference of a null pointer (loaded from variable 'self')"