Me arroja el siguiente error:
Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled. 2024-05-15T11:34:56.376-06:00 ERROR 11476 --- [screenmatch] [ main] o.s.boot.SpringApplication : Application run failed
java.lang.NullPointerException: Cannot invoke "java.util.List.size()" because "episodiosTemporada" is null at com.aluracursos.screenmatch.principal.Principal.muestraElMenu(Principal.java:43) ~[classes/:na] at com.aluracursos.screenmatch.ScreenmatchApplication.run(ScreenmatchApplication.java:26) ~[classes/:na] at org.springframework.boot.SpringApplication.lambda$callRunner$5(SpringApplication.java:790) ~[spring-boot-3.2.5.jar:3.2.5] at org.springframework.util.function.ThrowingConsumer$1.acceptWithException(ThrowingConsumer.java:83) ~[spring-core-6.1.6.jar:6.1.6] at org.springframework.util.function.ThrowingConsumer.accept(ThrowingConsumer.java:60) ~[spring-core-6.1.6.jar:6.1.6] at org.springframework.util.function.ThrowingConsumer$1.accept(ThrowingConsumer.java:88) ~[spring-core-6.1.6.jar:6.1.6] at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:798) ~[spring-boot-3.2.5.jar:3.2.5] at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:789) ~[spring-boot-3.2.5.jar:3.2.5] at org.springframework.boot.SpringApplication.lambda$callRunners$3(SpringApplication.java:774) ~[spring-boot-3.2.5.jar:3.2.5] at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183) ~[na:na] at java.base/java.util.stream.SortedOps$SizedRefSortingSink.end(SortedOps.java:357) ~[na:na] at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:510) ~[na:na] at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) ~[na:na] at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150) ~[na:na] at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173) ~[na:na] at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[na:na] at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596) ~[na:na] at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:774) ~[spring-boot-3.2.5.jar:3.2.5] at org.springframework.boot.SpringApplication.run(SpringApplication.java:341) ~[spring-boot-3.2.5.jar:3.2.5] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1354) ~[spring-boot-3.2.5.jar:3.2.5] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1343) ~[spring-boot-3.2.5.jar:3.2.5] at com.aluracursos.screenmatch.ScreenmatchApplication.main(ScreenmatchApplication.java:20) ~[classes/:na]
Process finished with exit code 1
Eso ocurre cuando ejecuto este bloque de código en la clase Principal:
for (int i = 0; i < datos.totalDeTemporadas(); i++) {
List<DatosEpisodio> episodiosTemporada = temporadas.get(i).episodios();
for (int j = 0; j < episodiosTemporada.size(); j++) {
System.out.println(episodiosTemporada.get(j).titulo());
}
}
Ya he intentado de todo y me sigue apareciendo el error. ¿Qué debo hacer?