try nilobject not being caught because of scale

I ran into a weird problem relating to scale, as in a lot of lines of code.
The basic problem is I didn’t pass a folder item to the method that scales the picture, and it failed.
I ran a very small test project with just a canvas, the line passing the code, and the method scaling.
It caught the nil object.
In my app with many many lines, it won’t catch the line.
Do you have any idea why this happens?

Here’s the Scale Picture method. Same code but no catch with scale.

try 'Var p2 as Picture Var d as double Var w, h, neww, newh as integer w = PictureToScale.width h = PictureToScale.height d = min( Availablewidth/w,Availableheight/h ) // Calculate the factor with which to scale neww = w*d // the new width of the picture newh = h*d // the new height of the picture Var p2 as Picture = new Picture( Availablewidth, Availableheight, PictureToScale.Depth ) p2.Graphics.DrawPicture PictureToScale, (Availablewidth-neww)\\2, (Availableheight-newh)\\2, neww, newh, 0, 0, w, h return p2 Catch err As OutOfMemoryException MessageBox("Insufficient memory to draw the picture!") Return Nil Catch err As NilObjectException MessageBox("The Picture Cannot be Used Because of " + err.ErrorNumber.ToText) Return Nil Catch err As UnsupportedFormatException MessageBox("The Picture Cannot be Used Because of " + err.ErrorNumber.ToText) Return Nil End Try

How big is that picture you’re creating?

It doesn’t exist.

It is quite literally a nil object

The scale is lines of code. I have 2 mb of code and some things act funny when I do

There should be no behavior difference based on the size of a method. If this can be replicated with that one method in a simple project, a bug report would be great so we can take a look.

Keep in mind that the IDE has tens of megabytes of code and we don’t run into this problem.

Could the exception be happening in the method that’s calling this method? You are returning Nil after all.

[quote=495589:@Greg O’Lone]Keep in mind that the IDE has tens of megabytes of code and we don’t run into this problem.

Could the exception be happening in the method that’s calling this method? You are returning Nil after all.[/quote]
I definitely understand and that’s why I ask here instead of filing a feedback. I have one of similar type (scale) and I don’t expect it to be solved. The exception is happening in that method above - ScalePicture.

I tried downsizing my app’s code, and I had 3 windows and whole lot less code. The Try worked properly. Grumble.

The other bug came in at about a Mb of code.