If you're new to programming, my advice would be to focus on other things first. These "laws" are things you can worry about later. First get things working and slowly improve your code style along with your learning curve.
My question is two fold. Is the other solution better and follow the law of demeter? If yes, then can you provide a scenario where my code will be problematic and not adaptable to change?
In this case, I don't really feel like it would matter and it completely depends on the preferences within your company/team.
However, maybe my view is too simplistic.