BUG: Return null pointer if class label does not exist (#3235)

When GetClassSample() method is called, it looks up the internal index
of the given class label, but does not consider whether the label exists
or not. If the label does not exist, -1 will be used as the internal
index and an invalid pointer is returned. In addition, it is not
possible to check whether a particular class label exists or not. By
returning null for non-existent class labels, both issues are addressed.

Change-Id: I3c4c5b40267318a7e6d5cf7c6f55cb00cea38aab
Merge topic 'getclasssample-fix'

6c012a6e BUG: Return null pointer if class label does not exist (#3235)