Callers of ResourceLoader::getModule should check for null return
authorOri Livneh <ori@wikimedia.org>
Thu, 3 Apr 2014 23:09:09 +0000 (16:09 -0700)
committerOri Livneh <ori@wikimedia.org>
Fri, 4 Apr 2014 00:29:53 +0000 (17:29 -0700)
commit51581fee860dbd5768d79e05601b87d9feaac76a
tree878570860f6cacf34189fbe05c42fa55bd6d7ad9
parent912f53996e93cc3842f00b261f91e5137701c277
Callers of ResourceLoader::getModule should check for null return

ResourceLoader::getModule returns null if cannot find a ResourceLoaderModule
instance or a module configuration array matching the requested name. Existing
callers of that method chain ResourceLoaderModule method calls to the return
value of ResourceLoader::getModule without bothering to check for a null
result. This patch makes the documentation for the method more explicit, and it
adds checks for the return value to existing calls of the method. In some
cases, it is possible to reason to that the call will succeed, on the
assumption that missing modules would have been filtered out by earlier
iterations through the modules array. But in the interest of robustness, it is
always good to check.

Bug: 63310
Change-Id: Ic32f1e61ffee0383f7a8761423099041e3b6b8cc
includes/resourceloader/ResourceLoader.php