more G-Labs products

Author Topic: .Get() on ModulesManager Exception  (Read 703 times)

December 11, 2015, 11:25:04 PM
Read 703 times

maxflax

  • ***
  • Information
  • Full Member
  • Posts: 90
Hi,

When .WithAddress doesn't find any module with the provided address the .get() will explode the program.
So a length property would be nice to have and even better to provide .get() to return null when no modules are to be found.

December 12, 2015, 12:07:36 AM
Reply #1

Gene

  • *****
  • Information
  • Administrator
  • Posts: 1472
  • Tangible is the future!
    • Yet Another Programmer
http://genielabs.github.io/HomeGenie/api/ape/a00006.html#aa28e4d2ffff5d22b4a133bc8c70e2e39
and
http://genielabs.github.io/HomeGenie/api/ape/a00004.html#ab0d942add92683330bb62d6dcac6544a

Code: [Select]
var mods = Modules.InDomain("Some.Domain")....;
if (mods.SelectedModules.Count > 0) {
  // found at least one
}
// OR check if there's an instance
if (mods.Get().Instance != null) {
 // we've got a module
}
[code]

December 12, 2015, 12:35:07 AM
Reply #2

maxflax

  • ***
  • Information
  • Full Member
  • Posts: 90
Good stuff I will try it out.

And It works :)
« Last Edit: December 12, 2015, 01:02:25 AM by maxflax »