Skip to content

Commit

Permalink
fix a bug of "labels" NullReferenceException
Browse files Browse the repository at this point in the history
  • Loading branch information
noodlefighter committed Aug 9, 2015
1 parent 963c630 commit 36afe22
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion LabelPlus/PicView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -360,10 +360,13 @@ public void SetLabels(List<LabelItem> items)
MakeImage(ref image, ref imageOriginal);
}

int getLabelIndex(int x, int y) {
int getLabelIndex(int x, int y) {
if (labels == null) return -1;

float realX = startP.X*zoom +x;
float realY = startP.Y*zoom +y;
PointF realP = new PointF(realX,realY);

RectangleF[] rectList = new RectangleF[labels.Count];
for (int i=0;i<labels.Count;i++) {
RectangleF tmpRect = getLabelRectangle(labels[i].X_percent, labels[i].Y_percent);
Expand Down

0 comments on commit 36afe22

Please sign in to comment.