Skip to content

Commit

Permalink
Be sure to open the model before getting relevant information. Issue #…
Browse files Browse the repository at this point in the history
  • Loading branch information
matiasdelellis committed Aug 24, 2023
1 parent ff949b3 commit ca75eeb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/Controller/SettingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ public function setAppValue($type, $value) {
$message = $this->l10n->t("The maximum recommended area is %s", $this->getFourByThreeRelation($value));
$status = self::STATE_ERROR;
}
$model->open();
$maxImageArea = $model->getMaximumArea();
if ($value > $maxImageArea) {
$value = $maxImageArea;
Expand Down
8 changes: 7 additions & 1 deletion lib/Settings/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,13 @@ public function getForm() {

$model = $this->modelManager->getCurrentModel();
if (!is_null($model)) {
$maxImageRange = strval($model->getMaximumArea());
try {
$model->open();
$maxImageRange = strval($model->getMaximumArea());
} catch (\Exception $e) {
$resume .= $e->getMessage();
$isConfigured = false;
}
} else {
$resume .= $this->l10n->t("It seems you don't have any model installed.");
$isConfigured = false;
Expand Down

0 comments on commit ca75eeb

Please sign in to comment.