Null in DB causes DBViewer to not display entry

Post bug reports and ask for game support here.

Moderator: MOD_Command

Post Reply
KnightHawk75
Posts: 1850
Joined: Thu Nov 15, 2018 7:24 pm

Null in DB causes DBViewer to not display entry

Post by KnightHawk75 »

Example from CMO build 1147.30 release posting.

Build 1147.29 or 30 (probably anything before as well) along with DB3K 489.
ORIGINAL: tylerblakebrandon

SNB-1 Kansan -- Tonga (Air Force), 1996-2006, 1x does not appear to be viewable in the DB viewer.
Can Confirm.
This is caused by Database issue in db3k v489.

What's happening:
During the data conversion for display, an exception is caused, and trapped by the NativeWindow Callback, The error is: InvalidCast Exception. Conversion from DBNull to type Single is not valid.
Because of where the error is trapped and handled it does not get logged to the standard exception log.

Root cause:
The following Loadout ID's for the SNB-1 Kansan have NULL entries for PayloadWeightDragModifer. The code is expecting a non-null value.
#28420 (0.5 ton cargo[no drop])
#28421 (passenger, 1xVIP)
They are the only entries in v489 that are missing values for that field.
DBFix: DB490+ should modify these entries to contain data, looks like should be 0.0 for both, or maybe 0.0266 and 0.0, or whatever is actually right when it comes to #28420.
Also the piece of code could be changed to check for DBNull first and handle that case before conversion.
Additionally but unrelated to the problem, I think both weapon-record entries here for these in DataLoadoutWeapons table should be marking the entries Internal=1 since they both are internal cargo and don't involve drop ability, no?

edit:
If it helps save developer time, search for "Error at 200473", in DBFunctions, it'll be some function with the spec 'public static void \SOMETHING (ref Aircraft Arg1, int dbidprobablyAsArg2, bool mandatoryOnlyprobablyAsArg3)'. Inside (above what the try block message relates too) there is a line like 'Loadout loadout new Loadout(..long list of params ... including an inline conversions.ToSingle(datarow["PayloadWeightDragModifier"])) that's the conversion that throws.

Post Reply

Return to “Tech Support”