View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0002275 | FSSCP | SEXPs | public | 2010-07-29 15:38 | 2010-08-17 05:38 |
| Reporter | FSF | Assigned To | iss_mneur | ||
| Priority | normal | Severity | tweak | Reproducibility | always |
| Status | resolved | Resolution | fixed | ||
| Product Version | 3.6.12 RC4 | ||||
| Summary | 0002275: Assert on remove-background-bitmap with faulty index | ||||
| Description | When using the remove-background-bitmap SEXP with an index that has no background bitmap assigned to it (i.e. higher index than number of background bitmaps present), FSO gives an assert. A more comprehensive error message would be handy. | ||||
| Additional Information | Test mission attached, press 1 to produce error. | ||||
| Tags | No tags attached. | ||||
|
2010-07-29 15:38
|
|
|
2010-08-01 01:59
|
mantis_2275.diff (902 bytes)
Index: code/parse/sexp.cpp
===================================================================
--- code/parse/sexp.cpp (revision 6340)
+++ code/parse/sexp.cpp (working copy)
@@ -10260,7 +10260,13 @@
int slot = eval_num(n);
if (slot >= 0) {
- stars_mark_bitmap_unused( slot );
+ int instances = stars_get_num_bitmaps();
+ if ( instances > slot ) {
+ stars_mark_bitmap_unused( slot );
+ } else {
+ Error(LOCATION, "remove-background-bitmap: slot %d does not exist. Slot must be less than %d.",
+ slot, instances);
+ }
}
}
@@ -10343,7 +10349,13 @@
int slot = eval_num(n);
if (slot >= 0) {
- stars_mark_sun_unused( slot );
+ int instances = stars_get_num_suns();
+ if ( instances > slot ) {
+ stars_mark_sun_unused( slot );
+ } else {
+ Error(LOCATION, "remove-sun-bitmap: slot %d does not exist. Slot must be less than %d.",
+ slot, instances);
+ }
}
}
|
|
|
With attached patch, both remove-background-bitmap and remove-sun-bitmap now will issue an Error if an invalid index is passed via the sexp. |
|
|
Added to trunk in revision 6377 |
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2010-07-29 15:38 | FSF | New Issue | |
| 2010-07-29 15:38 | FSF | File Added: background.zip | |
| 2010-08-01 01:59 | iss_mneur | File Added: mantis_2275.diff | |
| 2010-08-01 01:59 | iss_mneur | Note Added: 0012284 | |
| 2010-08-01 01:59 | iss_mneur | Assigned To | => iss_mneur |
| 2010-08-01 01:59 | iss_mneur | Status | new => feedback |
| 2010-08-01 01:59 | iss_mneur | Resolution | open => fixed |
| 2010-08-17 05:38 | iss_mneur | Note Added: 0012316 | |
| 2010-08-17 05:38 | iss_mneur | Status | feedback => resolved |